Staff Badge in post_macros

Splicho

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

Reputation:

Hello,

I want to make a modification in post_macros. The function should fetch the admin status of the user and if true, place an font awesome icon on top of the post.
For now I tried this code

PHP:
           <xf:foreach loop="$total.users" value="$user">
                <xf:if is="$user.isMemberOf(3)">
                    <div class="staff-postbadge" title="Administrator">
                        <span class="stafficon"></span>
                    </div>
                </xf:if>
            </xf:foreach>

But it's not showing up, without the foreach and if statement, it looks like this



jYWMjjx.png


Which is what I exactly want to achieve.

Can somebody maybe help me out with the foreach function.
Thanks!
 

shqawe

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

Reputation:

Your modification should be in message_macros template not post_macros.
 

Splicho

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

Reputation:

Your modification should be in message_macros template not post_macros.
shqawe
PHP:
                <xf:if is="{$post.User.is_staff}">
                    <div class="staff-postbadge" title="Administrator">
                        <span class="stafficon"></span>
                    </div>
                </xf:if>

Worked fine.
 
Top