XF 2.1 Tip: How to show the postbit information (user info below avatar) under specific conditions

Stuart Wright

Well-known member
Wanted to share this with you. Wasn't sure where to post it.
Mods will have to relocate it if it's considered useful.

I wanted to display the postbit information (the information about a user shown under their avatar in posts)
  • to moderators and admin so they can instantly see useful information about users
  • to everyone in classified advert threads because a user's trader rating feedback is displayed there. Classified ad threads contain one of three prefixes. Prefix ids 1, 2 or 3.
Edit the message_macros template
Before the line
Code:
<xf:if is="$user.user_id">
Insert
Code:
<xf:if is="$xf.visitor.is_admin OR $xf.visitor.is_moderator OR in_array($__globals.thread.prefix_id, [1,2,3])">
and before
Code:
<span class="message-userArrow"></span>
insert
Code:
</xf:if>

Done.

Obviously this can be changed to any valid conditional.
 
Back
Top Bottom