Example #1
0
 public function check()
 {
     $errorArray = array();
     $baseErrorMsg = get_class($this) . '::store-check failed - ';
     if (!$this->user_id && '' == trim($this->user_password)) {
         $errorArray['user_password'] = $baseErrorMsg . 'user password is not set';
     }
     if (!$this->user_id && CUser::exists($this->user_username)) {
         $errorArray['user_exists'] = $baseErrorMsg . 'this user already exists';
     }
     $this->_error = $errorArray;
     return $errorArray;
 }
Example #2
0
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('User');
// !User's contact information not deleted - left for history.
if ($del) {
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg('deleted', UI_MSG_ALERT, true);
        $AppUI->redirect();
    }
    return;
}
if ($isNewUser) {
    // If userName already exists quit with error and do nothing
    if (CUser::exists($obj->user_username) == true) {
        $AppUI->setMsg('already exists. Try another username.', UI_MSG_ERROR, true);
        $AppUI->redirect();
    }
    $contact->contact_owner = $AppUI->user_id;
}
if ($msg = $contact->store($AppUI)) {
    $AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
    $obj->user_contact = $contact->contact_id;
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        if ($isNewUser && w2PgetParam($_REQUEST, 'send_user_mail', 0)) {
            notifyNewUserCredentials($contact->contact_email, $contact->contact_first_name, $obj->user_username, $_POST['user_password']);
        }