<dl class="plain inlineDataList userFields">
{content}
{if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile') && $user->isAccessible('canViewProfile')}
- {if $user->occupation}
+ {if $user->getUserOption('occupation', true)}
<dt>{lang}wcf.user.option.occupation{/lang}</dt>
- <dd>{$user->occupation}</dd>
+ <dd>{$user->getUserOption('occupation', true)}</dd>
{/if}
- {if $user->hobbies}
+ {if $user->getUserOption('hobbies', true)}
<dt>{lang}wcf.user.option.hobbies{/lang}</dt>
- <dd>{$user->hobbies}</dd>
+ <dd>{$user->getUserOption('hobbies', true)}</dd>
{/if}
{/if}
{event name='userFields'}
use wcf\data\user\group\UserGroup;
use wcf\data\DatabaseObject;
use wcf\data\IUserContent;
+use wcf\data\user\option\UserOption;
use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\system\language\LanguageFactory;
use wcf\system\request\IRouteController;
* list of group ids
* @var integer[]
*/
- protected $groupIDs = null;
+ protected $groupIDs;
/**
* true, if user has access to the ACP
* @var boolean
*/
- protected $hasAdministrativePermissions = null;
+ protected $hasAdministrativePermissions;
/**
* list of language ids
* @var integer[]
*/
- protected $languageIDs = null;
+ protected $languageIDs;
/**
* date time zone object
* @var \DateTimeZone
*/
- protected $timezoneObj = null;
+ protected $timezoneObj;
/**
* list of user options
- * @var string[]
+ * @var UserOption[]
*/
- protected static $userOptions = null;
+ protected static $userOptions;
/** @noinspection PhpMissingParentConstructorInspection */
/**
* Returns the value of the user option with the given name.
*
* @param string $name user option name
+ * @param boolean $filterDisabled suppress values for disabled options
* @return mixed user option value
*/
- public function getUserOption($name) {
+ public function getUserOption($name, $filterDisabled = false) {
$optionID = self::getUserOptionID($name);
if ($optionID === null) {
return null;
}
+ else if ($filterDisabled && self::$userOptions[$name]->isDisabled) {
+ return null;
+ }
if (!isset($this->data['userOption'.$optionID])) return null;
return $this->data['userOption'.$optionID];