Display User Title only if Custom?

Staxed

Active member
I'm using the mod to have user rank images (CSS version), so I commented out the line in the message_user_info that displays the User Title.

I have a member though asking about custom user titles, so I was wondering if there is a variable that can tell if a user has a custom title or not?

What I would like to be able to do, is put an if statement around the usertitle display code that will only show it if the user has a custom title.

If there is no way to say "If user has CustomTitle", then how would I go about doing "If user title != ManuallyTypedDefaultTitles"?
 
I think
HTML:
<xen:if hascontent="true"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></xen:if>
migth work around it
 
I think
HTML:
<xen:if hascontent="true"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></xen:if>
migth work around it

That's the default code to display the User Title, it doesn't differentiate between a default and a custom title at all. I don't want any default titles to show, only custom titles. So I'm trying to figure out how I can add check into that if statement to either only display custom titles, or I could manually say "If user title = Adminstrator (etc), do not display).
 
That's the default code to display the User Title, it doesn't differentiate between a default and a custom title at all. I don't want any default titles to show, only custom titles. So I'm trying to figure out how I can add check into that if statement to either only display custom titles, or I could manually say "If user title = Adminstrator (etc), do not display).
Well I didn't look at the default code that was of the top of my head
go to your admincp >> users and override each user groups title as nothing so than when they add one is will show vs not
 
I think
HTML:
<xen:if hascontent="true"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></xen:if>
migth work around it
This will show any user title though (including the default user title ladder). I'm not sure if it's possible... unless you create an array of all the default user titles and say (in code, obviously) "if user title != array of default titles, display user title"

EDIT: or try vodkaholic's method ;)
 
This will show any user title though (including the default user title ladder). I'm not sure if it's possible... unless you create an array of all the default user titles and say (in code, obviously) "if user title != array of default titles, display user title"

EDIT: or try vodkaholic's method ;)

I wouldn't mind doing that, my only issue is I don't know how to do it in code. I'd even be happy just adding a bunch of != statements into the xen:if, I'm not sure how to write it though.

Well I didn't look at the default code that was of the top of my head
go to your admincp >> users and override each user groups title as nothing so than when they add one is will show vs not

That would remove the titles from the Info Card as well, which I don't want :D
 
So on the cards you want it to say "new member" as example and not on the thread list?

Correct, I want the User Title to show in the User Card, but on the actual thread view I have images that show the default usertitles, so it would be redundant to show the default titles as well, so I only want it to show Custom Titles people have.
 
Correct, I want the User Title to show in the User Card, but on the actual thread view I have images that show the default usertitles, so it would be redundant to show the default titles as well, so I only want it to show Custom Titles people have.
Don't think that could be done but someone else might know.
 
My installation is completely broke ATM due to my server so I can't check it.
General Q: is it possible to grab a default user title without needing an array of user info?
 
{$user.custom_title}

It only has a value if they have a custom title. Replace the {xen:helper userTitle, ...} with that in the places that you want to only display with the custom title.

You may also wish to use <xen:if is="{$user.custom_title}">...</xen:if> to wrap areas that should only be displayed if there's a custom title.
 
{$user.custom_title}

It only has a value if they have a custom title. Replace the {xen:helper userTitle, ...} with that in the places that you want to only display with the custom title.

You may also wish to use <xen:if is="{$user.custom_title}">...</xen:if> to wrap areas that should only be displayed if there's a custom title.

awesome, thanks so much :D
 
Necromancer hat on .... I used the following;
Code:
<xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{$user.custom_title}</xen:contentcheck></em></xen:if>
 
Top Bottom