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

Delete userblurb comma

Discussion in 'Styling and Customization Questions' started by Morgain, Jan 14, 2012.

  1. Morgain

    Morgain Well-Known Member

    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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);
    	}
    
     
  3. Morgain

    Morgain Well-Known Member

    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)
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    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.
     
  5. psTubble27

    psTubble27 Well-Known Member

    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.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I don't know of a way to do this with an addon. You can't extend the template classes.
     
  7. ragtek

    ragtek Guest

  8. Morgain

    Morgain Well-Known Member

    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
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    $user isn't available to category_view. You can use $visitor instead if you want to display information for the logged in user.
     
  10. Morgain

    Morgain Well-Known Member

    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.
     
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Well category_view has no member list, so I am wondering where the user records are coming from.
     

Share This Page