I did this not too long ago and went one step further. This is for an alumni website where some of the users registering might have both a ’maiden’ and ’married’ last name. You can just skip the married name parts & remove the related ’if’ logic if yo don’t need that.
The registration call: (Note the custom fields and that firstname & lastname are required, but not marriedname):
[!WebLoginPE? &type=`register` ®Type=`instant` ®isterTpl=`SignUpForm` &groups=`Pending Users` &customFields=`firstname,lastname,marriedname,emailprivate,phoneprivate,mobilephoneprivate,address1private,dobprivate,website,aim,aimprivate,msn,msnprivate,yahoo,yahooprivate,myspace,myspaceprivate,facebook,facebookprivate,city,address1` &inputHandler=`Keep private:userProfileEmailPrivate:emailprivate:checkbox:()||Keep private:userProfilePhonePrivate:phoneprivate:checkbox:()||Keep private:userProfileMobilePhonePrivate:mobilephoneprivate:checkbox:()||Keep private:userProfileAddress1Private:address1private:checkbox:()||Keep private:userProfileDOBPrivate:dobprivate:checkbox:()||Keep private:userProfileAIMPrivate:aimprivate:checkbox:() ||Keep private:userProfileMSNPrivate:msnprivate:checkbox:()||Keep private:userProfileYahooPrivate:yahooprivate:checkbox:()||Keep private:userProfileMyspacePrivate:myspaceprivate:checkbox:()||Keep private:userProfileFacebookPrivate:facebookprivate:checkbox:()` ¬ify=`[email protected],[email protected]` ¬ifyTpl=`NotifyAdmin` &pruneDays=`365` ®SuccessId=`57` ®SuccessPause=`0` ®Required=`email,username,firstname,lastname,password,tos` &liHomeId=`56,48`!]</p>
Then, a small hack in
webloginpe.class around line 418 (the block below starts at 405 for reference):
function Register($regType, $groups, $regRequired, $notify, $notifyTpl, $notifySubject)
{
global $modx;
$web_users = $modx->getFullTableName('web_users');
$web_user_attributes = $modx->getFullTableName('web_user_attributes');
$web_groups = $modx->getFullTableName('web_groups');
$webgroup_names = $modx->getFullTableName('webgroup_names');
$username = $_POST['username'];
$this->Username = $username;
$password = $modx->db->escape($modx->stripTags($_POST['password']));
$passwordConfirm = $modx->db->escape($modx->stripTags($_POST['password_confirm']));
// edited by sjh_vt Oct 4, 2008
// $fullname = $modx->db->escape($modx->stripTags($_POST['fullname']));
if ($_POST['marriedname']=='')
$fullname = $modx->db->escape($modx->stripTags($_POST['firstname'].' '.$_POST['lastname']));
else
$fullname = $modx->db->escape($modx->stripTags($_POST['firstname'].' ('.$_POST['lastname'].') '.$_POST['marriedname']));
//
$email = $modx->db->escape($modx->stripTags($_POST['email']));
$phone = $modx->db->escape($modx->stripTags($_POST['phone']));
$mobilephone = $modx->db->escape($modx->stripTags($_POST['mobilephone']));
$fax = $modx->db->escape($modx->stripTags($_POST['fax']));
$dob = $modx->db->escape($modx->stripTags($_POST['dob']));
$gender = $modx->db->escape($modx->stripTags($_POST['gender']));
$country = $modx->db->escape($modx->stripTags($_POST['country']));
$state = $modx->db->escape($modx->stripTags($_POST['state']));
$zip = $modx->db->escape($modx->stripTags($_POST['zip']));
$comment = $modx->db->escape($modx->stripTags($_POST['comment']));
$cachepwd = time();
// Check for required fields.
Obviously, the actual login form has these fields clearly explained. And for what it’s worth, the version of WLPE that I used for this was 1.3.1 in case there are differences between versions. The actual registration page if you’re interested is at
http://www.spauldingclassof87.net/home/register.html