0

I have created the following plugin which is intended to serve as a custom registration widget.

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" placeholder = "username">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for = "firstname">First Name <strong>*</strong></label>';
    $html .= '<input type = "text" name = "firstname" placeholder = "firstname">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for = "middlename">Middle Name </label>';
    $html .= '<input type = "text" name = "middlename" placeholder = "middlename">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for = "lastname">Last Name <strong>*</strong></label>';
    $html .= '<input type="text" name="lastname" placeholder= "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" placeholder = "password">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for = "companyname">Company Name</label>';
    $html .= '<input type="text" name="companyname" placeholder = "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" placeholder = "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" placeholder  = "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" placeholder  = "phone">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for = "fax">Fax</label>';
    $html .= '<input type="text" name = "fax" placeholder  = "fax">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="email">Email <strong>*</strong></label>';
    $html .= '<input type="text" name = "email" placeholder = "email">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="website">Website</label>';
    $html .= '<input type="text" name="website" placeholder ="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" placeholder ="workaddress1">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="homeaddress1">Home Address 1</label>';
    $html .= '<input type="text" name="homeaddress1" placeholder ="homeaddress1">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="bio">Biography / Areas of Specialty</label>';
    $html .= '<input type="text"  name="bio" placeholder = "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" placeholder ="workaddress2">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="homeaddress2">Home Address 2</label>';
    $html .= '<input type="text" name="homeaddress2" placeholder ="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" placeholder ="workcity">';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="homecity">City</label>';
    $html .= '<input type="text" name="homecity" placeholder ="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" placeholder ="workzip"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="homezip">Home Zip Code</label>';
    $html .= '<input type="text" name="homezip" placeholder ="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" placeholder ="billingsameashome"/><br/>';
    $html .= '<label for="billingsameaswork">Billing Address Same as Work Address?</label>';
    $html .= '<input type="checkbox" name="billingsameaswork" placeholder ="billingsameaswork"/><br/>';
    $html .= '</div';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="photologfilename">Photo/Logo Filename</label>';
    $html .= '<input type="file" name="photologfilename" placeholder ="photologofilename"/>';
    $html .= '<input type="submit" name="contactnext"/>';
    $html .= '</div>';
    $html .= '</div>'; // close tabpane
    $html .= '<div role="tabpanel" class="tab-pane container-fluid id="designations>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="chfcbox" placeholder ="chfcbox" />';
    $html .= '<label for="chfcbox">ChFC&copy; (The American College)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="chfcdate">Date Earned</label>';
    $html .= '<input type="date" name="chfcdate" placeholder ="chfcdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="chfccert">Certificate#</label>';
    $html .= '<input type="text" name="chfccert" placeholder ="chfccert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />';
    $html .= '<label for="pfsbox">PFS&trade; (AICPA - American Institute of CPAs)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfsdate">Date Earned</label>';
    $html .= '<input type="date" name="pfsdate" placeholder ="pfsdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfscert">Certificate#</label>';
    $html .= '<input type="text" name="pfscert" placeholder ="pfscert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />';
    $html .= '<label for="pfsbox">PFS&trade; (AICPA - American Institute of CPAs)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfsdate">Date Earned</label>';
    $html .= '<input type="date" name="pfsdate" placeholder ="pfsdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfscert">Certificate#</label>';
    $html .= '<input type="text" name="pfscert" placeholder ="pfscert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="cfpbox" placeholder ="cfpbox" />';
    $html .= '<label for="pfsbox">CFP&copy; (CFP Board)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="cfpdate">Date Earned</label>';
    $html .= '<input type="date" name="cfpdate" placeholder ="cfpdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="cfpcert">Certificate#</label>';
    $html .= '<input type="text" name="cfpcert" placeholder ="cfpcert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="msfsbox" placeholder ="msfsbox" />';
    $html .= '<label for="msfsbox">MSFS (The American College)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="msfsdate">Date Earned</label>';
    $html .= '<input type="date" name="msfsdate" placeholder ="msfsdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="msfscert">Certificate#</label>';
    $html .= '<input type="text" name="msfscert" placeholder ="msfscert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="msbox" placeholder ="msbox" />';
    $html .= '<label for="msbox">MS (College for Financial Planning)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="msdate">Date Earned</label>';
    $html .= '<input type="date" name="msdate" placeholder ="msdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="mscert">Certificate#</label>';
    $html .= '<input type="text" name="mscert" placeholder ="mscert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />';
    $html .= '<label for="pfsbox">PFS&trade; (AICPA - American Institute of CPAs)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfsdate">Date Earned</label>';
    $html .= '<input type="date" name="pfsdate" placeholder ="pfsdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="pfscert">Certificate#</label>';
    $html .= '<input type="text" name="pfscert" placeholder ="pfscert"/>';
    $html .= '</div>';
    $html .= '<hr>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="checkbox" name="qfpbox" placeholder ="qfpbox" />';
    $html .= '<label for="qfpbox">QFP (Qualified Financial Planner)</label>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="qfpdate">Date Earned</label>';
    $html .= '<input type="date" name="qfpdate" placeholder ="qfpdate"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="qfpcert">Certificate#</label>';
    $html .= '<input type="text" name="qfpcert" placeholder ="qfpcert"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="othercreds">Other Credentials or Designations (e.g. CPA, CLU, Esq.)</label>';
    $html .= '<input type="text" name="othercreds" placeholder ="othercreds"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<input type="submit" name="designationnext" value="Next"/>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '</div>'; // close designations tab
    $html .= '<div role="tabpanel" class="tab-pane container-fluid" id="attestation">';
    $html .= '<div class="row">';
    $html .= '<div class="col-md-3">';
    $html .= '<div class="btn-group" data-toggle="buttons">';
    $html .= '<label class="btn btn-primary">';
    $html .= '<input type="radio" name="options" id="membership">Membership (Includes Full Listing in QFP Registry):';
    $html .= '</label>';
    $html .= '<label class="btn btn-primary">';
    $html .= '<input type="radio" name="options" id="nonmember">Non-Membership / QFP Registrant Only:>';
    $html .= '</label>';
    $html .= '<label class="btn btn-primary">';
    $html .= '<input type="radio" name="options" id="nocharge">N/C for First Year QFP Registry Registrants (Includes Name &amp; QFP Only - Must select Membership Above for Full Registry Lising):>';
    $html .= '</label>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="ccnumber">Credit Card Number</label>';
    $html .= '<input type="text" name="ccnumber" placeholder ="ccnumber"/>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="expmonth">Expiration Month</label>';
    $html .= '<select name="expmonth" type="text">';
    $html .= '<option value="">Select...</option>';
    $html .= '<option value="1">January</option>';
    $html .= '<option value="2">February</option>';
    $html .= '<option value="3">March</option>';
    $html .= '<option value="4">April</option>';
    $html .= '<option value="5">May</option>';
    $html .= '<option value="6">June</option>';
    $html .= '<option value="7">July</option>';
    $html .= '<option value="8">August</option>';
    $html .= '<option value="9">September</option>';
    $html .= '<option value="10">October</option>';
    $html .= '<option value="11">November</option>';
    $html .= '<option value="12">December</option>';
    $html .= '</select>';
    $html .= '</div>';
    $html .= '<div class="col-md-3">';
    $html .= '<label for="expyear">Expiration Year</label>';
    $html .= '<select name="expyear" type="text">';
    $html .= '<option value="2016">2016</option>';
    $html .= '<option value="2017">2017</option>';
    $html .= '<option value="2018">2018</option>';
    $html .= '<option value="2019">2019</option>';
    $html .= '<option value="2020">2020</option>';
    $html .= '<option value="2021">2021</option>';
    $html .= '<option value="2022">2022</option>';
    $html .= '<option value="2023">2023</option>';
    $html .= '<option value="2024">2024</option>';
    $html .= '<option value="2025">2025</option>';
    $html .= '<option value="2026">2026</option>';
    $html .= '</select>';
    $html .= '<label for="cvvcode">CVV Code</label>';
    $html .= '<input type="text" name="cvvcode" placeholder ="cvvcode">';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="row">';
    $html .= '<div class = "col-md-6">';
    $html .= '<label border-width="1px">
                        Next I, ';
    echo $firstname;
    ' ';
    echo $lastname;
    ' hereby attest, under penalty of perjury and subject to 
                        a monetary penalty of not less than $10,000, that I hae earned or been granted or  one
                        or more of the herein indicated underlying qualifying designations of
                        Financial Planning, and that I have not here made any false or misleading 
                        representations.
                    </label>';
    $html .= '</div>';
    $html .= '<div class="col-md-6">';
    $html .= '<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Code-of-Ethics-Professional-Conduct.pdf" target="_blank">IAQFP Code of Ethics and Professional Conduct</a>';
    $html .= '<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Disciplinary-Procedures-Complaint-Process.pdf" target="_blank">IAQFP Disciplinary Procedures and Complaint Process</a>';
    $html .= '<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Certified-Financial-Planners-QFP-Designation-Usage-Guidelines.pdf" target="_blank">IAQFP Certified Financial Planner Usage Guidelines</a>';
    $html .= '<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Continuing-Education-Requirements.pdf" target="_blank">IAQFP Continuing Education Requirements</a>';
    $html .= '<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Membership-Agreement.pdf" target="_self"> IAQFP Membership Agreement</a>';
    $html .= '<input type="submit" name="reg_submit" value="I Agree />';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '</div>'; // close attestation tab
    $html .= '</form>';
    $html .= '</div>';
    $html .= '</div> ';
    return $html;
    $userdata = array(
        'email'=>$email,
        'username'=>$username,
        'password'=>$password,
    );
    $userid = wp_insert_user($userdata);
    $data = array(
        'firstname'=> $firstname,
        'middlename'=> $middlename,
        'lastname'=> $lastname,
        'workaddress1' => $workaddress1,
        'workaddress2' => $workaddress2,
        'workcity' => $workcity,

    );
    foreach($data as $k => $v){
        update_user_meta($userid, $k, v);
    }
    if(is_wp_error($userid)){
        echo 'User registration failed';
    }
    else{
        echo 'User registration succeeded.  We will verify credentials and follow up via email.';
    }
}


 }

function register_qfpform(){
    register_widget('registration_form');
    add_action('widgets_init', 'register_qfpform');
}

}

After installing the plugin into my local Wordpress site, the qfpregister widget is not listed in my available widgets page. What other steps are needed to ensure the widget is made available?

1
  • 1
    Can you please reduce your code to the necessary parts (and correct the formatting/ code indentation)?
    – kaiser
    Jul 6, 2016 at 0:26

1 Answer 1

0

There's a lot of reasons this isn't working. The best place to to start is the Widgets API page in the Codex. It outlines a basic class for creating a widget. At a minimum, you need a class with a __construct(), widget(), form(), and update() function.

You also need to register your widget correctly. The register_widget() function takes the class of the widget as its parameter, whereas at the moment you're sending through a function name.

Your widget registration is also never being called, because your hook is only added inside the function it calls: which means it can never be added, because it's never called.

Move the widget registration outside of your class, and set it up like this:

function register_qfpform(){
    register_widget('qfpregister');
}

add_action('widgets_init', 'register_qfpform');

You can find out more about hooks (filters and actions) work in general on the Codex' Plugin API page.

After this, you'll need to look at your registration_form() function and probably move most of the code into the widget() function. The widget() function outputs the frontend code of the widget, whereas the form() function outputs the backend code. Your current registration_form() function is also quite broken - there's a return; down towards the end, before the update code, which means the update code is never going to run.

It's also a bit unclear what you're trying to do: the function returns the contents of the variable $html, but there's also a number of echo statements before that which would directly echo the person's first and last name, outside of the rest of the flow of the form.

I'll point you back to the Widgets API page in the Codex. Start with the example there as a base, and build upon that. What you have right now is a hotch potch of code that isn't going to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.