XF 2.2 Conditional based on conversation starter

sHORTYWZ

Member
Hi all - I'm hoping to add a bit of a warning box or something along those lines which would appear when reading a conversation started by a user in a given usergroup. Is the usergroup of the conversation starter exposed to the template engine at all, or is there another way of doing what I'm trying to accomplish, perhaps?

We're trying to get people to stop and pay a bit more attention when receiving PMs from new users, but I need to maintain the ability of new users to send PMs for trading.

Appreciate any suggestions!
 

Dragonfruit

Well-known member
Hi @sHORTYWZ
I came up with this just playing around:
Code:
<xf:if is="{{$message.User.isMemberOf(X)}} && {{$message.position == 0}}">
Your content
</xf:if>
Replace X with the desired usergroup ID.

Edit:
Ah nope, it's showing on every user's message position in my messages.
 

Dragonfruit

Well-known member
It does not seem message positions is possible, but this might be a workaround. In
conversation_message_macros, under:
Code:
<header class="message-attribution">
Try adding:
Code:
<xf:if is="{{$message.User.isMemberOf(X)}}">Your warning</xf:if>

It could add a warning bar just above the new user's conversation messages. Not entirely ideal, but still seems as effective.
 
Top