• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Delete userblurb comma

Morgain

Well-known member
#1
Have tried several things so help please.

Instead of
Female, from London

I want it to say:

Lady of London.

This is for the membercard
but I realise it will change the user strip in memberlist and follows too.

I have changed Female to Lady, and from to of in Phrases, added the final stop.
Cannot find what puts in the comma after the gender.
 

Jake Bunce

XenForo moderator
Staff member
#2
It's in the code:

XenForo_Template_Helper_Core::helperUserBlurb

This function defines all of the parts of the blurb and then combines them with commas:

Code:
	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);
	}
 

Morgain

Well-known member
#3
It's in the code:

XenForo_Template_Helper_Core::helperUserBlurb

This function defines all of the parts of the blurb and then combines them with commas:
Thanks Jake - that doesn't look like an ordinary template - where do I find it? (I'm OK to tweak direct in a file and ftp)
 

Brogan

XenForo moderator
Staff member
#4
It's in library/XenForo/Template/Helper/Core.php

Be aware that any changes made directly to the core files will be overwritten when upgrading.
 

psTubble27

Well-known member
#5
You could turn this into an addon, and override the helperUserBlurb() function, no?

This would let you modify the core function, without modifying the core file.
 

Jake Bunce

XenForo moderator
Staff member
#6
You could turn this into an addon, and override the helperUserBlurb() function, no?

This would let you modify the core function, without modifying the core file.
I don't know of a way to do this with an addon. You can't extend the template classes.
 

Morgain

Well-known member
#8
I copied the code for the userblurb into category_view and forum_view
It works OK except it doesn't display location.

Code:
<td><div style="font-size: small; float: left !important; margin-left: 10px;" class="userBlurb dimmed">{xen:helper userBlurb, $user}</div> </td>
On the main memberlist the same code gives

Username + Start Convo button + Usergroup + Gender + Location

On my subsection memberlist on category_view as above I get only

Username + Start Convo button + Usergroup + Gender
 

Jake Bunce

XenForo moderator
Staff member
#9
$user isn't available to category_view. You can use $visitor instead if you want to display information for the logged in user.
 

Morgain

Well-known member
#10
$user isn't available to category_view. You can use $visitor instead if you want to display information for the logged in user.
oops Jake
I tried
Code:
<div style="font-size: small; float: left !important; margin-left: 10px;" class="userBlurb dimmed">{xen:helper userBlurb, $visitor}</div>
That meant the list of members all displayed MY userblurb.

Sorry I guess I wasn't clear I'm trying to display a special memberlist. The right users are showing up, and the userblurb displays their primary usergroup, and gender accurately, but no location comes up.