本文整理汇总了PHP中UserStatus::setAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::setAll方法的具体用法?PHP UserStatus::setAll怎么用?PHP UserStatus::setAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserStatus
的用法示例。
在下文中一共展示了UserStatus::setAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfUpdateUserStatus
function wfUpdateUserStatus($username, $gender, $province, $city, $birthday, $status)
{
global $wgUser;
$city = trim($city);
$status = trim($status);
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_UNKNOWN);
// This feature is only available for logged-in users.
if (!$wgUser->isLoggedIn()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_LOGGED_IN);
return $out;
}
// No need to allow blocked users to access this page, they could abuse it, y'know.
if ($wgUser->isBlocked()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_BLOCKED);
return $out;
}
// Database operations require write mode
if (wfReadOnly()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_READ_ONLY);
return $out;
}
// Are we even allowed to do this?
if (!$wgUser->isAllowed('edit')) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_ALLOWED);
return $out;
}
if ($username === $wgUser->getName()) {
$us = new UserStatus($wgUser);
if ($us->setAll($gender, $province, $city, $birthday, $status)) {
$out = ResponseGenerator::getJson(ResponseGenerator::SUCCESS);
}
}
return $out;
}