本文整理匯總了PHP中XenForo_Template_Helper_Core::_userFieldsInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Template_Helper_Core::_userFieldsInfo方法的具體用法?PHP XenForo_Template_Helper_Core::_userFieldsInfo怎麽用?PHP XenForo_Template_Helper_Core::_userFieldsInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_Template_Helper_Core
的用法示例。
在下文中一共展示了XenForo_Template_Helper_Core::_userFieldsInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: helperUserFieldValue
/**
* Helper to fetch the HTML value of a custom user field
*
* @param array|string $field Either the field info array for a field, or just its field_id
* @param array $user User to whom the field belongs
* @param mixed $fieldValue Value of the field for $user
*
* @return string|boolean
*/
public static function helperUserFieldValue($field, array $user = array(), $fieldValue = null)
{
if (empty($user['user_id'])) {
return false;
}
if (!is_array($field)) {
if (empty(self::$_userFieldsInfo)) {
self::$_userFieldsInfo = XenForo_Application::get('userFieldsInfo');
}
if (!isset(self::$_userFieldsInfo[$field])) {
return false;
}
$field = self::$_userFieldsInfo[$field];
}
$fieldId = $field['field_id'];
if (isset(self::$_userFieldsValues[$user['user_id']][$fieldId])) {
return self::$_userFieldsValues[$user['user_id']][$fieldId];
}
if (is_null($fieldValue)) {
$fieldValue = $field['field_value'];
}
$value = XenForo_ViewPublic_Helper_User::getUserFieldValueHtml($field, $fieldValue);
if (is_array($value)) {
$value = implode(', ', $value);
}
self::$_userFieldsValues[$user['user_id']][$fieldId] = $value;
return $value;
}