use wcf\data\ITitledLinkObject;
use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
+use wcf\system\event\EventHandler;
use wcf\system\user\signature\SignatureCache;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
*/
public function isAccessible($name) {
/** @noinspection PhpVariableVariableInspection */
+ $data = ['result' => true, 'name' => $name];
+
switch ($this->$name) {
case self::ACCESS_EVERYONE:
- return true;
+ $data['result'] = true;
break;
case self::ACCESS_REGISTERED:
- return (WCF::getUser()->userID ? true : false);
+ $data['result'] = (WCF::getUser()->userID ? true : false);
break;
case self::ACCESS_FOLLOWING:
- return ($this->isFollowing(WCF::getUser()->userID) ? true : false);
+ $data['result'] = ($this->isFollowing(WCF::getUser()->userID) ? true : false);
break;
case self::ACCESS_NOBODY:
- return false;
+ $data['result'] = false;
break;
}
+
+ EventHandler::getInstance()->fireAction($this, 'isAccessible', $data);
+
+ return $data['result'];
}
/**
use wcf\data\session\SessionList;
use wcf\data\user\group\UserGroup;
use wcf\data\user\User;
+use wcf\system\event\EventHandler;
use wcf\system\WCF;
use wcf\util\StringUtil;
*/
public static function isVisible($userID, $canViewOnlineStatus) {
if (WCF::getSession()->getPermission('admin.user.canViewInvisible') || $userID == WCF::getUser()->userID) return true;
+
+ $data = ['result' => false, 'userID' => $userID, 'canViewOnlineStatus' => $canViewOnlineStatus];
switch ($canViewOnlineStatus) {
case 0: // everyone
- return true;
+ $data['result'] = true;
+ break;
case 1: // registered
- if (WCF::getUser()->userID) return true;
+ if (WCF::getUser()->userID) $data['result'] = true;
break;
case 2: // following
/** @noinspection PhpUndefinedMethodInspection */
- if (WCF::getUserProfileHandler()->isFollower($userID)) return true;
+ if (WCF::getUserProfileHandler()->isFollower($userID)) $data['result'] = true;
break;
}
- return false;
+ EventHandler::getInstance()->fireAction(get_called_class(), 'isVisible', $data);
+
+ return $data['result'];
}
}