florencia
Active member
how do I add a custom field in the userblurb? I would like to have: forum title, full name (custom field), organization (custom field), occupation/job title (custom field), location.
I removed the fields i don't want like gender in core.php, but how do I add the custom fields?
/**
* Helper, for the user blurb "Title, gender, age, from location".
*
* @param array $user
* @param boolean Include user title in blurb
*
* @return string
*/
public static function helperUserBlurb(array $user, $includeUserTitle = true)
{
if (!is_array($user) || empty($user['user_id']))
{
return '';
}
$parts = array();
if ($includeUserTitle && $userTitle = self::callHelper('usertitle', array($user)))
{
$parts[] = '<span class="userTitle" itemprop="title">' . $userTitle . '</span>';
}
/**if (!empty($user['gender']))
*{
* $parts[] = new XenForo_Phrase($user['gender']);
*}
*
*if (!isset($user['age']) && !empty($user['show_dob_year']) && !empty($user['dob_year']))
*{
* $user['age'] = self::_getModelFromCache('XenForo_Model_UserProfile')->getUserAge($user);
*}
*
*if (!empty($user['age']))
*{
* $parts[] = $user['age'];
*}
*/
if (!empty($user['location']))
{
$user['locationCensored'] = XenForo_Helper_String::censorString($user['location']);
$location = '<a href="'
. XenForo_Link::buildPublicLink('misc/location-info', '', array('location' => $user['locationCensored']))
. '" class="concealed" target="_blank" rel="nofollow">'
. htmlspecialchars($user['locationCensored'])
. '</a>';
$parts[] = new XenForo_Phrase('from_x_location', array('location' => $location), false);
}
return implode(', ', $parts);
}
I removed the fields i don't want like gender in core.php, but how do I add the custom fields?
/**
* Helper, for the user blurb "Title, gender, age, from location".
*
* @param array $user
* @param boolean Include user title in blurb
*
* @return string
*/
public static function helperUserBlurb(array $user, $includeUserTitle = true)
{
if (!is_array($user) || empty($user['user_id']))
{
return '';
}
$parts = array();
if ($includeUserTitle && $userTitle = self::callHelper('usertitle', array($user)))
{
$parts[] = '<span class="userTitle" itemprop="title">' . $userTitle . '</span>';
}
/**if (!empty($user['gender']))
*{
* $parts[] = new XenForo_Phrase($user['gender']);
*}
*
*if (!isset($user['age']) && !empty($user['show_dob_year']) && !empty($user['dob_year']))
*{
* $user['age'] = self::_getModelFromCache('XenForo_Model_UserProfile')->getUserAge($user);
*}
*
*if (!empty($user['age']))
*{
* $parts[] = $user['age'];
*}
*/
if (!empty($user['location']))
{
$user['locationCensored'] = XenForo_Helper_String::censorString($user['location']);
$location = '<a href="'
. XenForo_Link::buildPublicLink('misc/location-info', '', array('location' => $user['locationCensored']))
. '" class="concealed" target="_blank" rel="nofollow">'
. htmlspecialchars($user['locationCensored'])
. '</a>';
$parts[] = new XenForo_Phrase('from_x_location', array('location' => $location), false);
}
return implode(', ', $parts);
}