$add->gender = $user['gender'];
$add->birthdate = $user['birthdate'];
$add->usertype = $user['type'];
if (!$add->isUsername($user['username'])) {
    ossn_trigger_message(ossn_print('username:error'), 'error');
    redirect(REF);
}
if (!$add->isPassword()) {
    ossn_trigger_message(ossn_print('password:error'), 'error');
    redirect(REF);
}
if ($add->isOssnUsername()) {
    ossn_trigger_message(ossn_print('username:inuse'), 'error');
    redirect(REF);
}
if ($add->isOssnEmail()) {
    ossn_trigger_message(ossn_print('email:inuse'), 'error');
    redirect(REF);
}
//check if email is valid email
if (!$add->isEmail()) {
    ossn_trigger_message(ossn_print('email:invalid'), 'error');
    redirect(REF);
}
if ($add->addUser()) {
    ossn_trigger_message(ossn_print('account:created'), 'success');
    redirect(REF);
} else {
    ossn_trigger_message(ossn_print('account:create:error:admin'), 'error');
    redirect(REF);
}
Example #2
0
if (!in_array($user['type'], $types)) {
    ossn_trigger_message(ossn_print('account:create:error:admin'), 'error');
    redirect(REF);
}
$user['birthdate'] = "{$user['bdd']}/{$user['bdm']}/{$user['bdy']}";
$OssnUser = new OssnUser();
$OssnUser->password = $password;
$OssnUser->email = $user['email'];
$OssnDatabase = new OssnDatabase();
$params['table'] = 'ossn_users';
$params['wheres'] = array("guid='{$entity->guid}'");
$params['names'] = array('first_name', 'last_name', 'email', 'type');
$params['values'] = array($user['firstname'], $user['lastname'], $user['email'], $user['type']);
//check if email is not in user
if ($entity->email !== input('email')) {
    if ($OssnUser->isOssnEmail()) {
        ossn_trigger_message(ossn_print('email:inuse'), 'error');
        redirect(REF);
    }
}
//check if email is valid email
if (!$OssnUser->isEmail()) {
    ossn_trigger_message(ossn_print('email:invalid'), 'error');
    redirect(REF);
}
//check if password then change password
if (!empty($password)) {
    if (!$OssnUser->isPassword()) {
        ossn_trigger_message(ossn_print('password:error'), 'error');
        redirect(REF);
    }