How to make custom usertitles have the same styling as the usergroup?

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

I tried in message_macros

HTML:
        <p class="member_title">
            <xf:if is="{{ $xf.user.isMemberOf(3) }}">
                <xf:usertitle user="$user" class="title_gid admin" />
            <xf:elseif is="{{ $xf.user.isMemberOf(11) }}" />
                <xf:usertitle user="$user" class="title_gid supermod" />
            <xf:elseif is="{{ $xf.user.isMemberOf(10) }}" />
                <xf:usertitle user="$user" class="title_gid mod" />
            </xf:if>

But that doesn't work, my title just disappears.
 
Last edited:

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

Deleted

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,520
Points
523

Reputation:

Edit

I tried in message_macros

HTML:
        <p class="member_title">
            <xf:if is="{{ $xf.user.isMemberOf(3) }}">
                <xf:usertitle user="$user" class="title_gid admin" />
            <xf:elseif is="{{ $xf.user.isMemberOf(11) }}" />
                <xf:usertitle user="$user" class="title_gid supermod" />
            <xf:elseif is="{{ $xf.user.isMemberOf(10) }}" />
                <xf:usertitle user="$user" class="title_gid mod" />
            </xf:if>

But that doesn't work, my title just disappears.
WaduhekBefore:
Blok.png


Create a template modification like this:

Template: message_macros
Find:
HTML:
<xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" />
Replace:
HTML:
<xf:usertitle user="$user" rich="true" tag="h5" class="message-userTitle username--style{$user.display_style_group_id}" banner="true" itemprop="jobTitle" />

After:
Blok.png
 

shqawe

Well-known member
Registered
Joined
Jun 30, 2019
Messages
63
Points
28

Reputation:

If you do like what you did in first picture
You can then use the name of class which is admin in extra.less template like this for example

CSS:
.admin{
    color: red
}

And you can do the same for each group
 

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

If you do like what you did in first picture
You can then use the name of class which is admin in extra.less template like this for example

CSS:
.admin{
    color: red
}

And you can do the same for each group
shqaweYes I know.

But I want it so that when users set custom usertitle, it'll have the same styling as the usergroup they're in.
 
View previous replies…

shqawe

Well-known member
Registered
Joined
Jun 30, 2019
Messages
63
Points
28

Reputation:

Yes I know.

But I want it so that when users set custom usertitle, it'll have the same styling as the usergroup they're in.
WaduhekIn this case you have to change this code in message_macro template from this
HTML:
<xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" />

to this

HTML:
<xf:usertitle user="$user" tag="h5" class="message-userTitle userGroupColor-{{$user.user_group_id}}" banner="true" itemprop="jobTitle" />

Then in extra.less template you have to add this class userGroupColor followed by group number as below:

HTML:
// Admins group
.userGroupColor-3{
color: red
}

// Users group


.userGroupColor-2{
color: green
}

I hope this is what you want.
 

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

In this case you have to change this code in message_macro template from this
HTML:
<xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" />

to this

HTML:
<xf:usertitle user="$user" tag="h5" class="message-userTitle userGroupColor-{{$user.user_group_id}}" banner="true" itemprop="jobTitle" />

Then in extra.less template you have to add this class userGroupColor followed by group number as below:

HTML:
// Admins group
.userGroupColor-3{
color: red
}

// Users group


.userGroupColor-2{
color: green
}

I hope this is what you want.
shqaweI did a work around i think

message_macros

Code:
 <p class="member_title">
            <xf:if is="{{ $user.isMemberOf(3) }}">
                <xf:usertitle user="$user" class="title_gid admin-title" />
            <xf:elseif is="{{ $user.isMemberOf(11) }}" />
                <xf:usertitle user="$user" class="title_gid supermod-title" />
            <xf:elseif is="{{ $user.isMemberOf(10) }}" />
                <xf:usertitle user="$user" class="title_gid mod-title" />
            <xf:elseif is="{{ $user.isMemberOf(15) }}" />
                <xf:usertitle user="$user" class="title_gid supreme-title" />
            <xf:elseif is="{{ $user.isMemberOf(14) }}" />
                <xf:usertitle user="$user" class="title_gid infinity-title" />
            <xf:elseif is="{{ $user.isMemberOf(13) }}" />
                <xf:usertitle user="$user" class="title_gid olympus-title" />
             <xf:else />
                    <xf:usertitle user="$user" class="title_gid" />
            </xf:if>
        </p>

It works, but it's weird because it only works if you are in the primary group, not secondary.
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,520
Points
523

Reputation:

I did a work around i think

message_macros

Code:
 <p class="member_title">
            <xf:if is="{{ $user.isMemberOf(3) }}">
                <xf:usertitle user="$user" class="title_gid admin-title" />
            <xf:elseif is="{{ $user.isMemberOf(11) }}" />
                <xf:usertitle user="$user" class="title_gid supermod-title" />
            <xf:elseif is="{{ $user.isMemberOf(10) }}" />
                <xf:usertitle user="$user" class="title_gid mod-title" />
            <xf:elseif is="{{ $user.isMemberOf(15) }}" />
                <xf:usertitle user="$user" class="title_gid supreme-title" />
            <xf:elseif is="{{ $user.isMemberOf(14) }}" />
                <xf:usertitle user="$user" class="title_gid infinity-title" />
            <xf:elseif is="{{ $user.isMemberOf(13) }}" />
                <xf:usertitle user="$user" class="title_gid olympus-title" />
             <xf:else />
                    <xf:usertitle user="$user" class="title_gid" />
            </xf:if>
        </p>

It works, but it's weird because it only works if you are in the primary group, not secondary.
WaduhekDo not know why you do not take the changes I've posted, what is wrong with that?
 

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

Do not know why you do not take the changes I've posted, what is wrong with that?
BattleKingYour code works as well, but I only want colored titles for specific user groups.
"Normal Users" for example should have a grey username, while the others I specified should have a colored one.

With your code, every usergroup with a colored styling will have a colored title.
 

thomsa

Moderator
Staff member
Moderator
S.V.I.P Member
Collaborate
Registered
Joined
Jun 22, 2019
Messages
1,072
Points
173

Reputation:

Your code works as well, but I only want colored titles for specific user groups.
"Normal Users" for example should have a grey username, while the others I specified should have a colored one.

With your code, every usergroup with a colored styling will have a colored title.
Waduhektest use $xf.visitor.isMemberOf(x) instead $user.isMemberOf(x).

HTML:
<p class="member_title">
            <xf:if is="{{$xf.visitor.isMemberOf(3)}}">
                <xf:usertitle user="$user" class="title_gid admin-title" />
            <xf:elseif is="{{$xf.visitor.isMemberOf(11)}}" />
                <xf:usertitle user="$user" class="title_gid supermod-title" />
            <xf:elseif is="{{$xf.visitor.isMemberOf(10)}}" />
                <xf:usertitle user="$user" class="title_gid mod-title" />
            <xf:elseif is="{{$xf.visitor.isMemberOf(15)}}" />
                <xf:usertitle user="$user" class="title_gid supreme-title" />
            <xf:elseif is="{{$xf.visitor.isMemberOf(14)}}" />
                <xf:usertitle user="$user" class="title_gid infinity-title" />
            <xf:elseif is="{{$xf.visitor.isMemberOf(13)}}" />
                <xf:usertitle user="$user" class="title_gid olympus-title" />
             <xf:else />
                    <xf:usertitle user="$user" class="title_gid" />
            </xf:if>
        </p>
 
Top