I've created a multi-part tabbed registration form that includes about 40-45 custom fields aside from user name, password and email. The goal is to create a new user registration and store the validated / sanitized contents of the field inputs into a new table in the database. This table will be used as a registry and searched by public users.
When I call wp_create_user, the only 3 allowable arguments are user name, password and email. Is there another hook I should call that will post in my other fields?
Here is my form thus far:
class qfpregister extends WP_Widget
{
static private $login_registration_status;
static function registration_form(){
$username = esc_attr( $_POST['username']);
$password = esc_attr( $_POST['password']);
$firstname = esc_attr( $_POST['firstname']);
$middlename = esc_attr( $_POST['middlename']);
$lastname = esc_attr( $_POST['lastname']);
$companyname = esc_attr($_POST['companyname']);
$dateofbirth = esc_attr($_POST['dateofbirth']);
$ssn = esc_attr($_POST['ssn']);
$workaddress1 = esc_attr($_POST['workaddress1']);
$workaddress2 = esc_attr($_POST['workaddress2']);
$workcity = esc_attr($_POST['workcity']);
$workstate = esc_attr($_POST['workstate']);
$workzipcode = esc_attr($_POST['workzipcode']);
$homeaddress1 = esc_attr($_POST['homeaddress1']);
$homeaddress2 = esc_attr($_POST['homeaddress2']);
$homecity = esc_attr($_POST['homecity']);
$homestate = esc_attr($_POST['homestate']);
$homezipcode = esc_attr($_POST['homezipcode']);
$phone = esc_attr($_POST['phone']);
$fax = esc_attr($_POST['fax']);
$email = esc_attr($_POST['email']);
$website = esc_attr($_POST['website']);
$biography = esc_attr($_POST['biography']);
$photofilename = esc_attr($_POST['photofilename']);
$billingsameashome = esc_attr($_POST['billingsameashome']);
$billingsameaswork = esc_attr($_POST['billingsameaswork']);
$chfcearneddate = esc_attr($_POST['chfcearneddate']);
$chfccert = esc_attr($_POST['chfccert']);
$pfsearneddate = esc_attr($_POST['pfsearneddate']);
$pfscert = esc_attr($_POST['pfscert']);
$msfsearneddate = esc_attr($_POST['msfsearneddate']);
$msfscert = esc_attr($_POST['msfscert']);
$msearneddate = esc_attr($_POST['msearneddate']);
$mscert = esc_attr($_POST['mscert']);
$qfpearneddate = esc_attr($_POST['qfpearneddate']);
$qfpcert = esc_attr($_POST['qfpcert']);
$othercreds = esc_attr($_POST['othercreds']);
$regtype = esc_attr($_POST['regtype']);
$ccnumber = esc_attr($_POST['ccnumber']);
$ccexpmonth = esc_attr($_POST['ccexpmonth']);
$ccexpyear = esc_attr($_POST['ccexpyear']);
$cvvnumber = esc_attr($_POST['cvvnumber']);
/*
{
$html =
'<div>';
$html .= '<!-- Nav Tabs -->';
$html .= '<ul class="nav nav-tabs" role="tablist">';
$html .= '<li role="presentation" class="active"><a href="#contactinfo" aria-controls="contactinfo" role="tab"
data-toggle="tab">Contact Info</a></li>';
$html .= '<li role="presentation"><a href="#designations" aria-controls="designations" role="tab"
data-toggle="tab">Underlying Qualifying Designations</a></li>';
$html .= '<li role="presentation"><a href="#attestation" aria-controls="attestation" role="tab"
data-toggle="tab">Attestation</a></li>';
$html .= '</ul>';
$html .= '</div>';
$html .= '<div class="tab-content">';
$html .= '<div role="tabpanel" class="tab-pane active container-fluid" id="contactinfo">';
$html .= '<form action = "' . $_SERVER['REQUEST_URI'] . '" method = "post" enctype="multipart/form-data">';
$html .= '<div class = "row">';
$html .= '<div class="col-md-3">';
$html .= '<label for = "username">Username <strong>*</strong></label>';
$html .= '<input type = "text" name = "username" value = "username">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for = "firstname">First Name <strong>*</strong></label>';
$html .= '<input type = "text" name = "firstname" value = "firstname">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for = "middlename">Middle Name </label>';
$html .= '<input type = "text" name = "middlename" value = "middlename">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for = "lastname">Last Name <strong>*</strong></label>';
$html .= '<input type="text" name="lastname" value = "lastname">';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html = '<div class="col-md-3">';
$html .= '<label for = "passowrd">Password <strong>*</strong></label>';
$html .= '<input type = "password" name = "password" value = "password">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for = "companyname">Company Name</label>';
$html .= '<input type="text" name="companyname" value = "companyname">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="dateofbirth">Date of Birth <strong>*</strong></label>';
$html .= '<input type="date" name="dateofbirth" value = "dateofbirth">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="ssn">Social Security Number <strong>*</strong></label>';
$html .= '<input pattern="{d3}-{d2}-{d4}" name="ssn" value = "ssn">';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for = "phone">Phone Number <strong>*</strong></label>';
$html .= '<input type="text" name="phone" value = "phone">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for = "fax">Fax</label>';
$html .= '<input type="text" name = "fax" value = "fax">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="email">Email <strong>*</strong></label>';
$html .= '<input type="text" name = "email" value = "email">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="website">Website</label>';
$html .= '<input type="text" name="website" value="website">';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label><strong>Business Address</strong></label>';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label><strong>Home Address</strong></label>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for="workaddress1">Business Address 1</label>';
$html .= '<input type="text" name="workaddress1" value="workaddress1">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="homeaddress1">Home Address 1</label>';
$html .= '<input type="text" name="homeaddress1" value="homeaddress1">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="bio">Biography / Areas of Specialty</label>';
$html .= '<input type="text" name="bio" >';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for="workaddress2">Business Address 2</label>';
$html .= '<input type="text" name="workaddress2" value="workaddress2">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="homeaddress2">Home Address 2</label>';
$html .= '<input type="text" name="homeaddress2" value="homeaddress2">';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for="workcity">City</label>';
$html .= '<input type="text" name="workcity" value="workcity">';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="homecity">City</label>';
$html .= '<input type="text" name="homecity" value="homecity">';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for="workstate">State</label>';
$html .= '<select name="workstate" type="text">';
$html .= '<option value="">Select...</option>';
$html .= '<option value="AL">Alabama</option>';
$html .= '<option value="AK">Alaska</option>';
$html .= '<option value="AZ">Arizona</option>';
$html .= '<option value="AR">Arkansas</option>';
$html .= '<option value="CA">California</option>';
$html .= '<option value="CO">Colorado</option>';
$html .= '<option value="CT">Connecticut</option>';
$html .= '<option value="DC">District of Columbia</option>';
$html .= '<option value="DE">Delaware</option>';
$html .= '<option value="FL">Florida</option>';
$html .= '<option value="GA">Georgia</option>';
$html .= '<option value="HI">Hawaii</option>';
$html .= '<option value="ID">Idaho</option>';
$html .= '<option value="IL">Illinois</option>';
$html .= '<option value="IN">Indiana</option>';
$html .= '<option value="IA">Iowa</option>';
$html .= '<option value="KS">Kansas</option>';
$html .= '<option value="KY">Kentucky</option>';
$html .= '<option value="LA">Louisiana</option>';
$html .= '<option value="ME">Maine</option>';
$html .= '<option value="MD">Maryland</option>';
$html .= '<option value="MA">Massachusetts</option>';
$html .= '<option value="MI">Michigan</option>';
$html .= '<option value="MN">Minnesota</option>';
$html .= '<option value="MS">Mississippi</option>';
$html .= '<option value="MO">Missouri</option>';
$html .= '<option value="MT">Montana</option>';
$html .= '<option value="NE">Nebraska</option>';
$html .= '<option value="NV">Nevada</option>';
$html .= '<option value="NH">New Hampshire</option>';
$html .= '<option value="NJ">New Jersey</option>';
$html .= '<option value="NM">New Mexico</option>';
$html .= '<option value="NY">New York</option>';
$html .= '<option value="NC">North Carolina</option>';
$html .= '<option value="ND">North Dakota</option>';
$html .= '<option value="OH">Ohio</option>';
$html .= '<option value="OK">Oklahoma</option>';
$html .= '<option value="OR">Oregon</option>';
$html .= '<option value="PA">Pennsylvania</option>';
$html .= '<option value="RI">Rhode Island</option>';
$html .= '<option value="SC">South Carolina</option>';
$html .= '<option value="SD">South Dakota</option>';
$html .= '<option value="TN">Tennessee</option>';
$html .= '<option value="TX">Texas</option>';
$html .= '<option value="UT">Utah</option>';
$html .= '<option value="VA">Virginia</option>';
$html .= '<option value="VT">Vermont</option>';
$html .= '<option value="WA">Washington</option>';
$html .= '<option value="WV">West Virginia</option>';
$html .= '<option value="WI">Wisconsin</option>';
$html .= '<option value="WY">Wyoming</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="homestate">State</label>';
$html .= '<select name="homestate" type="text">';
$html .= '<option value="">Select...</option>';
$html .= '<option value="AL">Alabama</option>';
$html .= '<option value="AK">Alaska</option>';
$html .= '<option value="AZ">Arizona</option>';
$html .= '<option value="AR">Arkansas</option>';
$html .= '<option value="CA">California</option>';
$html .= '<option value="CO">Colorado</option>';
$html .= '<option value="CT">Connecticut</option>';
$html .= '<option value="DC">District of Columbia</option>';
$html .= '<option value="DE">Delaware</option>';
$html .= '<option value="FL">Florida</option>';
$html .= '<option value="GA">Georgia</option>';
$html .= '<option value="HI">Hawaii</option>';
$html .= '<option value="ID">Idaho</option>';
$html .= '<option value="IL">Illinois</option>';
$html .= '<option value="IN">Indiana</option>';
$html .= '<option value="IA">Iowa</option>';
$html .= '<option value="KS">Kansas</option>';
$html .= '<option value="KY">Kentucky</option>';
$html .= '<option value="LA">Louisiana</option>';
$html .= '<option value="ME">Maine</option>';
$html .= '<option value="MD">Maryland</option>';
$html .= '<option value="MA">Massachusetts</option>';
$html .= '<option value="MI">Michigan</option>';
$html .= '<option value="MN">Minnesota</option>';
$html .= '<option value="MS">Mississippi</option>';
$html .= '<option value="MO">Missouri</option>';
$html .= '<option value="MT">Montana</option>';
$html .= '<option value="NE">Nebraska</option>';
$html .= '<option value="NV">Nevada</option>';
$html .= '<option value="NH">New Hampshire</option>';
$html .= '<option value="NJ">New Jersey</option>';
$html .= '<option value="NM">New Mexico</option>';
$html .= '<option value="NY">New York</option>';
$html .= '<option value="NC">North Carolina</option>';
$html .= '<option value="ND">North Dakota</option>';
$html .= '<option value="OH">Ohio</option>';
$html .= '<option value="OK">Oklahoma</option>';
$html .= '<option value="OR">Oregon</option>';
$html .= '<option value="PA">Pennsylvania</option>';
$html .= '<option value="RI">Rhode Island</option>';
$html .= '<option value="SC">South Carolina</option>';
$html .= '<option value="SD">South Dakota</option>';
$html .= '<option value="TN">Tennessee</option>';
$html .= '<option value="TX">Texas</option>';
$html .= '<option value="UT">Utah</option>';
$html .= '<option value="VA">Virginia</option>';
$html .= '<option value="VT">Vermont</option>';
$html .= '<option value="WA">Washington</option>';
$html .= '<option value="WV">West Virginia</option>';
$html .= '<option value="WI">Wisconsin</option>';
$html .= '<option value="WY">Wyoming</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row">';
$html .= '<div class="col-md-3">';
$html .= '<label for "workzip">Work Zip Code</label>';
$html .= '<input type="text" name="workzip" value="workzip"/>';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="homezip">Home Zip Code</label>';
$html .= '<input type="text" name="homezip" value="homezip"/>';
$html .= '</div>';
$html .= '<div class="col-md-3">';
$html .= '<label for="billingsameashome">Billing Address Same as Home Address?</label>';
$html .= '<input type="checkbox" name="billingsameashome" value="billingsameashome"/><br/>';
$html .= '<label for="billingsameaswork">Billing Address Same as Work Address?</label>';
$html .= '<input type="checkbox" name="billingsameaswork" value="billingsameaswork"/><br/>';
$html .= '</div';
$html .= '<div class="col-md-3">';
$html .= '<label for="photologfilename">Photo/Logo Filename</label>';
$html .= '<input type="file" name="photologfilename" value="photologofilename"/>';
$html .= '<input type="submit" name="contactnext"/>';
$html .= '</div>';
$html .= '</div>'; // close tabpane
return $html;
}
}
What function(s) should be called to add the new user and the corresponding data as meta inputs on the user record?
add_action('user_register', 'my_insert_callback', 10, 1)
. This passes the new inserted user id to the callback functionmy_insert_callback
function you would have access to the newly created user id, likemy_insert_callback($user_id)
. In that function, you will perform your db queries (or meta inserts)