View Full Version : Display icon if user is n a specific user group
eviljoker7075
03-31-2012, 02:41 PM
Can anyone help with a bit of code. I would like to add an icon in the postbit template next to a users post if the poster is in a specific user group.
Is this possible?
The closest I've got so far is:
<vb:if condition="is_member_of($bbuserinfo, 6)">Icon here</vb:if>
But that just shows the icon next to all posts if the user you're logged in as is within that group.
Iain M
03-31-2012, 02:57 PM
Try:
<vb:if condition="$post['usergroupid'] == 6">Icon</vb:if>
Lynne
03-31-2012, 03:34 PM
Or, how about just using Ranks?
eviljoker7075
03-31-2012, 03:53 PM
Try:
<vb:if condition="$post['usergroupid'] == 6">Icon</vb:if>
Thanks, does that work for additional usergroups too, or is there a different way of checking that?
I don't really want to use the user ranks as I want to expand this to more than just a line under the username, to include other features later down the line - but the thought did cross my mind :)
--------------- Added 1333213891 at 1333213891 ---------------
Ah, I think I found it!
<vb:if condition="is_member_of($post,6)">Icon</vb:if>
Iain M
03-31-2012, 04:13 PM
For additional usergroups try $post['membergroupids']
eviljoker7075
03-31-2012, 04:18 PM
Both of those work - is either better on performance etc?
Iain M
03-31-2012, 04:22 PM
I don't think either would have that much effect on performance. But your way would be tidier since that searches both the normal usergroups and additional usergroups =]
eviljoker7075
03-31-2012, 07:29 PM
Excellent, thank you very much for your help :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.