Xenforo 2.1 Registered usergroup Name in navbar next to my username

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

i want to show this Registered
usergroup in navbar next to my username
 

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

want
 

BattleKing

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

Reputation:

RolandLike this
Blok.png


or like this:
Blok.png


In Extra.less increase field size
Less:
.p-navgroup-link.p-navgroup-link--user {
    max-width: 550px;
}

Template modification
PAGE_CONTAINER

Search Simple

FIND:
PHP:
<span class="p-navgroup-linkText">{$xf.visitor.username}</span>

REPLACE:
PHP:
<span class="p-navgroup-linkText username--style{$xf.visitor.display_style_group_id}">
    <xf:if is="{$xf.visitor.display_style_group_id} == 1">
        Guest
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 2" />
        Registered
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 3" />
        Administrator
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 4" />
        Moderator
    <xf:else />
        Not fedined
    </xf:if>
         / {$xf.visitor.username}</span>

Last one need to be adapted, if new groups will be added.
 
Last edited:
View previous replies…

one_finger_man

Well-known member
Registered
Joined
Jan 20, 2022
Messages
378
Points
53

Reputation:

Like this
View attachment 30909

or like this:
View attachment 30910

In Extra.less increase field size
Less:
.p-navgroup-link.p-navgroup-link--user {
    max-width: 550px;

Template modification
PAGE_CONTAINER

Search Simple

FIND:
PHP:
<span class="p-navgroup-linkText">{$xf.visitor.username}</span>

REPLACE:
PHP:
<span class="p-navgroup-linkText username--style{$xf.visitor.display_style_group_id}">
    <xf:if is="{$xf.visitor.display_style_group_id} == 1">
        Guest
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 2" />
        Registered
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 3" />
        Administrator
    <xf:elseif is="{$xf.visitor.display_style_group_id} == 4" />
        Moderator
    <xf:else />
        Not fedined
    </xf:if>
         / {$xf.visitor.username}</span>

Last one need to be adapted, if new groups will be added.
BattleKingyou need to add this not the top
HTML:
.p-navgroup-link.p-navgroup-link--user {
    max-width: 550px;
}
 

BattleKing

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

Reputation:

BattleKing

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

Reputation:

no bro u didnt understand, i want this rank image to be left of username

just like above he did but i dont want text i want userrank
RolandSo just the image, which image, the image which has been assigned to the group?
 

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

So just the image, which image, the image which has been assigned to the group?
BattleKingrank image bro)
ss-png.30940
this i want to show this.
for all usergroups for example you admin im registered other guy vip member
the purpuse of this is users can see their rank in front of them
 

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

So just the image, which image, the image which has been assigned to the group?
BattleKinglook as as here
users can see their rank . this is from `

Welcome to your User Control Panel ` i want this to located in navbar and account upgrade page.​

22.png
 

BattleKing

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

Reputation:

rank image bro)
ss-png.30940
this i want to show this.
for all usergroups for example you admin im registered other guy vip member
the purpuse of this is users can see their rank in front of them
RolandLike this:

Blok.png


Thats easy, change the template modification like that:

FIND:
HTML:
                                <xf:avatar user="$xf.visitor" size="xxs" href="" title="" />
                                <span class="p-navgroup-linkText">{$xf.visitor.username}</span>

REPLACE
HTML:
<xf:userbanners user="$xf.visitor" tag="div" class="message-userBanner" itemprop="jobTitle" />
<xf:avatar user="$xf.visitor" size="xxs" href="" title="" />
<span class="p-navgroup-linkText username--style{$xf.visitor.display_style_group_id}">
    {$xf.visitor.username}
</span>

Please remeber to change field size as mentioned above. in EXTRA.LESS
Less:
.p-navgroup-link.p-navgroup-link--user {
   max-width: 550px;
}
 

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

i thought all is working well but

when i click to threads that staff member and administrator rank list horizontal

i guess we should add another extra less code
 

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

Blok (copy 1).png


when i enter thread
 

BattleKing

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

Reputation:

View previous replies…

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

hm good question, did not find the CSS which is responsible for that yet.
Further investigation need to be executed, maybe someone else might know the answer
BattleKingidk why its happend
should be that extra less code work but its not working

or can we erase it when entering a thread what should we do?
 

BattleKing

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

Reputation:

idk why its happend
should be that extra less code work but its not working

or can we erase it when entering a thread what should we do?
RolandNo you can leave the entered code in extra.less, it must be something different.
But I did not found it yet, need to check it later or as mentioned maybe someone else know it.
 

BattleKing

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

Reputation:

anyone fix this issue
RolandFound it, it will work without cXF Top Navigation, but if you want it there as well, you need an extra template modification.

First of all this was missing in the extra.less file:
Less:
.p-navgroup-link {
    .message-userBanner.userBanner {
    display: unset;
    }
}

If TOP Navigation is installed and Visitor Tab has been moved to there, you need this
TEMPLATE: cxf_top_navigation_visitor
FIND:
HTML:
                    <xf:avatar user="$xf.visitor" size="xxs" href="" title="" />
                    <span class="p-navgroup-linkText">{$xf.visitor.username}</span>

REPLACE
HTML:
<xf:avatar user="$xf.visitor" size="xxs" href="" title="" />
<span class="p-navgroup-linkText username--style{$xf.visitor.display_style_group_id}">
    {$xf.visitor.username}
</span>
<xf:userbanners user="$xf.visitor" tag="div" class="message-userBanner" itemprop="jobTitle" />
 

thomsa

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

Reputation:

Roland

Well-known member
Registered
Joined
Sep 19, 2022
Messages
89
Points
8

Reputation:

Top