{foreach from=$__sidebarUserOptions item='__sidebarUserOption'}
{if $userProfile->getUserOption($__sidebarUserOption)}
<dt>{lang}wcf.user.option.{$__sidebarUserOption}{/lang}</dt>
- <dd{if $__sidebarUserOption == 'location'} itemprop="locality"{/if}>{$userProfile->getUserOption($__sidebarUserOption)}</dd>
+ <dd{if $__sidebarUserOption == 'location'} itemprop="locality"{/if}>{@$userProfile->getFormattedUserOption($__sidebarUserOption)}</dd>
{/if}
{/foreach}
{/if}
use wcf\data\user\avatar\DefaultAvatar;
use wcf\data\user\avatar\Gravatar;
use wcf\data\user\avatar\UserAvatar;
+use wcf\data\user\option\ViewableUserOption;
use wcf\data\user\online\UserOnline;
use wcf\data\user\rank\UserRank;
use wcf\data\DatabaseObjectDecorator;
public function getSignature() {
return SignatureCache::getInstance()->getSignature($this->getDecoratedObject());
}
+
+ /**
+ * Returns the formatted value of the user option with the given name.
+ *
+ * @param string $name
+ * @return mixed
+ */
+ public function getFormattedUserOption($name) {
+ // get value
+ $value = $this->getUserOption($name);
+ if (!$value) return '';
+
+ $option = ViewableUserOption::getUserOption($name);
+ $option->setOptionValue($this->getDecoratedObject());
+ return $option->optionValue;
+ }
}
namespace wcf\data\user\option;
use wcf\data\user\User;
use wcf\data\DatabaseObjectDecorator;
+use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\system\exception\SystemException;
use wcf\util\ClassUtil;
use wcf\util\StringUtil;
*/
public static $outputObjects = array();
+ /**
+ * cached user options
+ * @var array<wcf\data\user\option\ViewableUserOption>
+ */
+ public static $userOptions = array();
+
/**
* user option value
* @var string
return self::$outputObjects[$this->outputClass];
}
+
+ /**
+ * Gets user option by name
+ *
+ * @param string $name
+ * @return wcf\data\user\option\ViewableUserOption
+ */
+ public static function getUserOption($name) {
+ if (!isset(self::$userOptions[$name])) {
+ $options = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
+ self::$userOptions[$name] = new ViewableUserOption($options[$name]);
+ }
+
+ return self::$userOptions[$name];
+ }
}
$sql = "SELECT optionName
FROM wcf".WCF_N."_user_option
WHERE categoryName LIKE 'profile%'
- AND optionType <> 'boolean'
- AND outputClass = ''";
+ AND optionType <> 'boolean'";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
.dataList {
> dt {
- width: 50%;
+ width: 45%;
}
> dd {
- margin-left: 53%;
+ margin-left: 48%;
+ word-wrap: break-word;
}
}
}