本文整理汇总了PHP中Wikia::invalidateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::invalidateUser方法的具体用法?PHP Wikia::invalidateUser怎么用?PHP Wikia::invalidateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::invalidateUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: closeAccount
/**
* Clears the user's password, sets an empty e-mail and marks as disabled
*
* @param User $user User account to close
* @param string $changeReason Reason for change
* @param string $mStatusMsg Main error message
* @param string $mStatusMsg2 Secondary (non-critical) error message
* @param boolean $keepEmail Optionally keep the email address in a
* user option
* @return boolean true on success, false on failure
*/
public static function closeAccount($user = '', $changeReason = '', &$mStatusMsg = '', &$mStatusMsg2 = '', $keepEmail = true)
{
if (empty($user)) {
throw new Exception('User object is invalid.');
}
$id = $user->getId();
# Set flag for Special:Contributions
# NOTE: requires FlagClosedAccounts.php to be included separately
if (defined('CLOSED_ACCOUNT_FLAG')) {
$user->setRealName(CLOSED_ACCOUNT_FLAG);
} else {
# magic value not found, so lets at least blank it
$user->setRealName('');
}
// remove users avatar
if (class_exists('Masthead')) {
$avatar = Masthead::newFromUser($user);
if (!$avatar->isDefault()) {
if (!$avatar->removeFile(false)) {
# dont quit here, since the avatar is a non-critical part of closing, but flag for later
$mStatusMsg2 = wfMessage('editaccount-remove-avatar-fail')->plain();
}
}
}
// close account and invalidate cache + cluster data
Wikia::invalidateUser($user, true, $keepEmail, true);
// if they are connected from facebook, disconnect them
self::disconnectFromFacebook($user);
if ($user->getEmail() == '') {
$title = Title::newFromText('EditAccount', NS_SPECIAL);
// Log what was done
$log = new LogPage('editaccnt');
$log->addEntry('closeaccnt', $title, $changeReason, array($user->getUserPage()));
// All clear!
$mStatusMsg = wfMessage('editaccount-success-close', $user->mName)->plain();
wfRunHooks('EditAccountClosed', array($user));
return true;
} else {
// There were errors...inform the user about those
$mStatusMsg = wfMessage('editaccount-error-close', $user->mName)->plain();
return false;
}
}
示例2: resetUserProfile
/**
* Blanks user profile data
* @author grunny
*/
public function resetUserProfile()
{
global $wgMemc;
foreach ($this->optionsArray as $option) {
if ($option === 'gender' || $option === 'birthday') {
$option = self::USER_PROPERTIES_PREFIX . $option;
}
$this->user->setGlobalAttribute($option, null);
$this->user->saveSettings();
$wgMemc->delete($this->getMemcUserIdentityDataKey());
Wikia::invalidateUser($this->user);
}
}