Ok, let me attach the registration function that i use in case that helps to find a solution:
Code:
function registerUser( $fname, $lname, $email, $username, $password, $cb_profiletype, $approve = 0, $confirm = 0 ) {
global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
$approval = ( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
$confirmation = ( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
$usertype = $_CB_framework->getCfg( 'new_usertype' );
$user = new moscomprofilerUser( $_CB_database );
$user->usertype = ( $usertype ? $usertype : 'Registered' );
$user->gid = $_CB_framework->acl->get_group_id( $user->usertype, 'ARO' );
$user->gids = array( $user->gid );
$user->sendEmail = 0;
$user->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
$user->name = $fname . ' ' . $lname;
$user->firstname = $fname;
$user->lastname = $lname;
$user->username = $username;
$cb_profiletype = ",my-profile";
$user->cb_profiletype = $cb_profiletype;
$user->email = $email;
$user->password = $user->hashAndSaltPassword( $password );
$user->registeripaddr = cbGetIPlist();
if ( $approval == 0 ) {
$user->approved = 1;
} else {
$user->approved = 0;
}
$user->confirmed = 0;
if ( ( $user->confirmed == 1 ) && ( $user->approved == 1 ) ) {
$user->block = 0;
} else {
$user->block = 1;
}
$_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$user, &$user ) );
if ( $user->store() ) {
if ( ( $user->confirmed == 0 ) && ( $confirmation != 0 ) ) {
$user->_setActivationCode();
if ( ! $user->store() ) {
return false;
}
}
activateUser( $user, 1, 'UserRegistration' );
$_PLUGINS->trigger( 'onAfterUserRegistration', array( &$user, &$user, true ) );
return true;
}
return false;
}
and i call this like this:
Code:
if (isset($_POST['form']['Name']) && isset($_POST['form']['Lastname']) && isset($_POST['form']['email']) && isset($_POST['form']['password'])) {
$this->registerUser($_POST['form']['Name'],$_POST['form']['Lastname'],$_POST['form']['email'],$_POST['form']['Name'],$_POST['form']['password'],$_POST['form']['cb_profiletype'],0,0);
}
I include the code needed to load CB API externally.