XF 2 Tip Mod & Admin Verified Badge in Postbit tooltip

prvtzone

eleaks.to
Registered
Joined
Jul 29, 2019
Messages
122
Points
53

Reputation:

Untitled.png
Untitled1.png


Post this code under <h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" /></h4><br> in message_macro

Code:
    <xf:if is="{{$user.isMemberOf(3)}}">
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
        <xf:elseif is="{{$user.isMemberOf(3)}}"/>
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
            <xf:elseif is="{{$user.isMemberOf(4)}}"/>
    <div class="verified_badge verified_staff tooltip2 tooltipstered" data-xf-init="tooltip" title="Verified Staff Members"><i class="fa fa-check"></i></div>
        </xf:if>

Change the usergroup ID accordingly of admin and mod role.

Place this code inside extra.less

Code:
.verified_admin {
    background: rgb(207, 45, 45);
}

.verified_badge {
    position: absolute;
    width: 18px;
    height: 18px;
    text-align: center;
    top: -3px;
    left: 24px;
    cursor: pointer;
    line-height: 18px;
    font-size: 10px;
    color: rgb(255, 255, 255);
    z-index: 5;
    border-radius: 3px 3px 0px 0px;
}

.verified_badge::before {
    bottom: -15px;
    left: -1px;
    z-index: 0;
    border-width: 0px 10px 14px;
    border-color: transparent rgba(0, 0, 0, 0.1);
}

.verified_badge::after, .verified_badge::before {
    content: "";
    position: absolute;
    height: 0px;
    width: 0px;
    border-style: solid;
}

@media (max-width: 650px){
    .verified_badge {
        display:none !important;
    }
}


.verified_admin.verified_badge::after {
    border-color: transparent rgb(207, 45, 45);
}

.verified_badge::after {
    bottom: -12px;
    left: 0px;
    z-index: 3;
    border-width: 0px 9px 12px;
    border-color: transparent rgb(51,131,34);
}

.verified_staff {
    background: #348423;
}

If anyone have any issue regarding this code, then you can reply in the thread. i am willing to help everyone.

ALL Codes Credits Goes to : @Verss
 
Last edited:

DareSec

Inforc3r
Staff member
Administrator
Moderator
S.V.I.P Member
Collaborate
Registered
Joined
May 25, 2019
Messages
1,388
Points
523

Reputation:

Verss

Custom Developer
Collaborate
Registered
Joined
Apr 21, 2019
Messages
133
Points
53

Reputation:

basically u just leeching out from my theme
not being rude or anything lol
 

prvtzone

eleaks.to
Registered
Joined
Jul 29, 2019
Messages
122
Points
53

Reputation:

still it can help lots of new members here. Not being rude but sharing is caring right? it not available on enxf, so i posted it.
 

Verss

Custom Developer
Collaborate
Registered
Joined
Apr 21, 2019
Messages
133
Points
53

Reputation:

right :) but be more specific those codes all are from my theme
u just mentioned me for being inspirational to learn, that makes u created all of the codes not crediting me for those
 

Skynet

Collaborate
Collaborate
Registered
Joined
Sep 30, 2019
Messages
57
Points
63

Reputation:

Thanks for this. But for me its not working:

2020-04-22 19_19_57-Edit template_ message_macros _ Crossplay - Admin control panel.png


This is my message marco where i have to put the above code in:

Code:
<h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" />
                <div class="d-flex align-items-center justify-content-center flex-wrap post-stats">
                <div class="post-stat">
                    <span class="largetext">
                        <strong style="color:green; text-align: center;">{$user.af_as_award_total|number}</strong>
                    </span>
                    <br>
                    <span class="x-smalltext text-uppercase" style="font-weight:bold; ">Awards</span>
                </div>
                <div class="post-stat">
                    <span class="largetext"><strong style="color:green; text-align: center;">{$user.reaction_score|number}</strong></span>
                    <br> <span class="x-smalltext text-uppercase" style="font-weight:bold;">Likes</span>
                </div>
            </div>
            <p>
                <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
                    <xf:if is="property('xtr_conversation_button')">
                        <a href="{{ link('conversations/add', '', {'to': $user.username}) }}" data-xf-click="{{'overlay'}}" class="xm-icon button--link"><i class="fas fa-envelope" aria-hidden="true" data-xf-init="tooltip" title="{{ phrase('start_conversation')}}"></i></a>
                    </xf:if>
                </xf:if>
            </h4>
 
Last edited:

prvtzone

eleaks.to
Registered
Joined
Jul 29, 2019
Messages
122
Points
53

Reputation:

do you have discord? we can fix it on anydesk. this is because somewhere some code is not closed.
 

prvtzone

eleaks.to
Registered
Joined
Jul 29, 2019
Messages
122
Points
53

Reputation:

put it like this below. I updated my thread because i forgot to close this tag </xf:if> , now it should work for you .

Code:
<h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" />
              
    <xf:if is="{{$user.isMemberOf(3)}}">
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
        <xf:elseif is="{{$user.isMemberOf(3)}}"/>
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
            <xf:elseif is="{{$user.isMemberOf(4)}}"/>
    <div class="verified_badge verified_staff tooltip2 tooltipstered" data-xf-init="tooltip" title="Verified Staff Members"><i class="fa fa-check"></i></div>
        </xf:if>


                <div class="d-flex align-items-center justify-content-center flex-wrap post-stats">
                <div class="post-stat">
                    <span class="largetext">
                        <strong style="color:green; text-align: center;">{$user.af_as_award_total|number}</strong>
                    </span>
                    <br>
                    <span class="x-smalltext text-uppercase" style="font-weight:bold; ">Awards</span>
                </div>
                <div class="post-stat">
                    <span class="largetext"><strong style="color:green; text-align: center;">{$user.reaction_score|number}</strong></span>
                    <br> <span class="x-smalltext text-uppercase" style="font-weight:bold;">Likes</span>
                </div>
            </div>
            <p>
                <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
                    <xf:if is="property('xtr_conversation_button')">
                        <a href="{{ link('conversations/add', '', {'to': $user.username}) }}" data-xf-click="{{'overlay'}}" class="xm-icon button--link"><i class="fas fa-envelope" aria-hidden="true" data-xf-init="tooltip" title="{{ phrase('start_conversation')}}"></i></a>
                    </xf:if>
                </xf:if>
            </h4>
 

jhoancito

Well-known member
Registered
Joined
Mar 23, 2021
Messages
76
Points
18

Reputation:

put it like this below. I updated my thread because i forgot to close this tag </xf:if> , now it should work for you .

Code:
<h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" />
              
    <xf:if is="{{$user.isMemberOf(3)}}">
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
        <xf:elseif is="{{$user.isMemberOf(3)}}"/>
    <div class="verified_badge verified_admin tooltip2 tooltipstered" data-xf-init="tooltip" title="Administration Team"><i class="fa fa-check"></i></div>
            <xf:elseif is="{{$user.isMemberOf(4)}}"/>
    <div class="verified_badge verified_staff tooltip2 tooltipstered" data-xf-init="tooltip" title="Verified Staff Members"><i class="fa fa-check"></i></div>
        </xf:if>


                <div class="d-flex align-items-center justify-content-center flex-wrap post-stats">
                <div class="post-stat">
                    <span class="largetext">
                        <strong style="color:green; text-align: center;">{$user.af_as_award_total|number}</strong>
                    </span>
                    <br>
                    <span class="x-smalltext text-uppercase" style="font-weight:bold; ">Awards</span>
                </div>
                <div class="post-stat">
                    <span class="largetext"><strong style="color:green; text-align: center;">{$user.reaction_score|number}</strong></span>
                    <br> <span class="x-smalltext text-uppercase" style="font-weight:bold;">Likes</span>
                </div>
            </div>
            <p>
                <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
                    <xf:if is="property('xtr_conversation_button')">
                        <a href="{{ link('conversations/add', '', {'to': $user.username}) }}" data-xf-click="{{'overlay'}}" class="xm-icon button--link"><i class="fas fa-envelope" aria-hidden="true" data-xf-init="tooltip" title="{{ phrase('start_conversation')}}"></i></a>
                    </xf:if>
                </xf:if>
            </h4>
prvtzoneHello friend, I put this code, did you update? I get an error in the image, you go to where I added the code and where it ends, there is an error through the image, can you help me please?


Captura.PNG


Captura1.PNG


error.PNG
 

Skynet

Collaborate
Collaborate
Registered
Joined
Sep 30, 2019
Messages
57
Points
63

Reputation:

Thanks. Working now. But the icon is looking a really bit messed up for me. For me the icon is on the avatar!?
2020-04-22 20_21_03-Testeintrag _ Crossplay.png
 
Last edited:

prvtzone

eleaks.to
Registered
Joined
Jul 29, 2019
Messages
122
Points
53

Reputation:

@Skynet

You can change values of these two codes in extra.less to position it according to your requirements
Code:
   top: -3px;

    left: 24px;
 

5je7taxs

Well-known member
Registered
Joined
Jul 31, 2023
Messages
52
Points
18

Reputation:

  • Code:
    ErrorException: Template error: [E_USER_WARNING] Cannot call method isMemberOf on a non-object (NULL)
    src/XF/Template/Templater.php:1151
    Generated by: Unknown account
    Oct 25, 2023 at 8:58 PM
    
    
    Stack trace
    #0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/www/wwwroot/ha...', 1151)
    #1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
    #2 internal_data/code_cache/templates/l1/s3/public/message_macros.php(63): XF\Template\Templater->method(NULL, 'isMemberOf', Array)
    #3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, NULL)
    #4 internal_data/code_cache/templates/l1/s3/public/post_macros.php(25): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
    #5 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #6 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('user_cell', Array, Array, Object(XF\Template\ExtensionSet))
    #7 internal_data/code_cache/templates/l1/s3/public/post_macros.php(166): XF\Template\Templater->renderExtension('user_cell', Array, Object(XF\Template\ExtensionSet))
    #8 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #9 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
    #10 internal_data/code_cache/templates/l1/s3/public/post_macros.php(198): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
    #11 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #12 internal_data/code_cache/templates/l1/s3/public/thread_view.php(928): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
    #13 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #14 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
    #15 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
    #16 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
    #17 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #18 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #19 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
    #20 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
    #21 src/XF.php(488): XF\App->run()
    #22 index.php(20): XF::runApp('XF\\Pub\\App')
    #23 {main}

    getting this error anyone?
 

rigarus99

Well-known member
Registered
Joined
Sep 13, 2021
Messages
192
Points
53

Reputation:

  • Code:
    ErrorException: Template error: [E_USER_WARNING] Cannot call method isMemberOf on a non-object (NULL)
    src/XF/Template/Templater.php:1151
    Generated by: Unknown account
    Oct 25, 2023 at 8:58 PM
    
    
    Stack trace
    #0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/www/wwwroot/ha...', 1151)
    #1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
    #2 internal_data/code_cache/templates/l1/s3/public/message_macros.php(63): XF\Template\Templater->method(NULL, 'isMemberOf', Array)
    #3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, NULL)
    #4 internal_data/code_cache/templates/l1/s3/public/post_macros.php(25): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
    #5 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #6 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('user_cell', Array, Array, Object(XF\Template\ExtensionSet))
    #7 internal_data/code_cache/templates/l1/s3/public/post_macros.php(166): XF\Template\Templater->renderExtension('user_cell', Array, Object(XF\Template\ExtensionSet))
    #8 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #9 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
    #10 internal_data/code_cache/templates/l1/s3/public/post_macros.php(198): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
    #11 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #12 internal_data/code_cache/templates/l1/s3/public/thread_view.php(928): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
    #13 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
    #14 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
    #15 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
    #16 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
    #17 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #18 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #19 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
    #20 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
    #21 src/XF.php(488): XF\App->run()
    #22 index.php(20): XF::runApp('XF\\Pub\\App')
    #23 {main}

    getting this error anyone?
5je7taxsI have a similar issue with some single addons.
Do you have a solution for that now ?

:/
 
View previous replies…
Top