We are creating a secondary registration page for a different user type that requires different fields to be filled out. To do this, we are using the "
" method. It does check if email and username already exists and cancels out showing an alert displaying the error. For some reason the name does not return an error and simply goes to that screen.
Here is what the function looks like. Maybe you can find an error in the logic.
Code:
function registerUser( $FirstName, $LastName, $Email, $Username, $Password, $approve = 0, $confirm = 0, $PostalCode, $var1, $var2, $var3, $Street, $City, $Province, $Phone ) {
global $_CB_framework, $_CB_database, $ueConfig;
$postal = $PostalCode;
include('point.php');
$location = $city . ", " . $town . ", " . $province;
$approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
$confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
$usertype = $_CB_framework->getCfg( 'new_usertype' );
$row = new moscomprofilerUser( $_CB_database );
$row->usertype = ( $usertype ? $usertype : 'Agents' );
$row->gid = $_CB_framework->acl->get_group_id( $row->usertype, 'ARO' );
$row->sendEmail = 0;
$row->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
$row->name = $FirstName . ' ' . $LastName;
$row->firstname = $FirstName;
$row->lastname = $LastName;
$row->username = $Username;
$row->email = $Email;
$row->password = cbHashPassword( $Password );
$row->cb_var1 = $var1;
$row->cb_var2 = $var2;
$row->cb_var3 = $var3;
$row->cb_area = $location;
$row->cb_streetaddress = $Street;
$row->cb_city = $City;
$row->cb_province = $Province;
$row->ch_phone = $Phone;
$row->cb_postalcode = $postal;
$user->registeripaddr = cbGetIPlist();
if ( $approval == 0 ) { $row->approved = 1; }
else { $row->approved = 0; }
if($confirmation == 0) { $row->confirmed = 1; }
else { $row->confirmed = 0; }
if(($row->confirmed == 1) && ($row->approved == 1)) { $row->block = 0; }
else { $row->block = 1; }
if ( $row->store() ) {
if ( ( $row->confirmed == 0 ) && ( $confirmation != 0 ) ) {
$row->_setActivationCode();
if ( ! $row->store() ) {
echo "<SCRIPT LANGUAGE='javascript'>alert('Error" . $row->getError() . "'); </SCRIPT>";
return false;
}
}
return true;
}
echo "<SCRIPT LANGUAGE='javascript'> alert('Error" . $row->getError() . "'); </SCRIPT>";
return false;
}