本文整理匯總了PHP中Preferences::trySetUserEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Preferences::trySetUserEmail方法的具體用法?PHP Preferences::trySetUserEmail怎麽用?PHP Preferences::trySetUserEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Preferences
的用法示例。
在下文中一共展示了Preferences::trySetUserEmail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: attemptChange
/**
* @return bool|string true or string on success, false on failure
*/
protected function attemptChange(User $user, $pass, $newaddr)
{
if ($newaddr != '' && !Sanitizer::validateEmail($newaddr)) {
$this->error('invalidemailaddress');
return false;
}
$throttleCount = LoginForm::incLoginThrottle($user->getName());
if ($throttleCount === true) {
$this->error('login-throttled');
return false;
}
if (!$user->checkTemporaryPassword($pass) && !$user->checkPassword($pass)) {
$this->error('wrongpassword');
return false;
}
if ($throttleCount) {
LoginForm::clearLoginThrottle($user->getName());
}
list($status, $info) = Preferences::trySetUserEmail($user, $newaddr);
if ($status !== true) {
if ($status instanceof Status) {
$this->getOutput()->addHTML('<p class="error">' . $this->getOutput()->parseInline($status->getWikiText($info)) . '</p>');
}
return false;
}
$user->saveSettings();
return $info ? $info : true;
}
示例2: onPreferencesTrySetUserEmail
public static function onPreferencesTrySetUserEmail($user, $newEmail, &$result)
{
list($status, $info) = Preferences::trySetUserEmail($user, $newEmail);
/* @var $status Status */
if ($status instanceof Status && !$status->isGood()) {
$result = $status->getWikiText($info);
return false;
}
return true;
}