The User Class
User creation and manipulation.
- Integer|Array|False = User::confirmUsername( String $username, String $verification_code );
Verify and activate user (if not already verified).
Deletes verification reminder log for username.
String The username to be verified
String The verification code associated with the username
Integer $user_id if the username is succesfully confirmed. The username will be verified and the user will be activated (status = 1).
Array with the element "status" => "USER_VERIFIED" if the username is already verified.
False if confirmation fails (wrong username and/or wrong verification code).
$UC = new User(); $username = "email@example.com"; $verification_code = "7dof205k"; $user_id = $UC->confirmUsername($username, $verification_code);
- Array|Boolean = User::setPassword( Array $action );
Saves a new password posted by current user. If user has a password already, this is also posted for validation.
array action array
Array with the value "error" => "wrong_password" if the old password is not successfully verified. The new password is not saved.
False if the new password is not saved (password is not validated successfully or exactly one action parameter is not received.)
True if the new password is successfully saved.
$_POST["old_password"] = "SuperSecretAndWrongOldPassword"; $_POST["new_password"] = "SuperSecretNewPassword"; $UC = new User(); $result = $UC->setPassword($action);
Returns an array with information about the result of the function call. The new password was not saved, since the old password was not succesfully verified.
$result = ( ["error"] => "wrong_password" )
$_POST["old_password"] = "SuperSecretAndCorrectOldPassword"; $_POST["new_password"] = "SuperSecretNewPassword"; $UC = new User(); $result = $UC->setPassword($action);
Returns true. The new password was succesfully saved.
$result = true