PDA

View Full Version : IF Statement Question


Cledus James
11-29-2011, 12:06 AM
Ok basically I'm trying to display an image in postbit depending on whether or not the posting user is in X usergroup. Wondering if anyone can help me out with a simple IF statement.

<if condition="$post['usergroupid'] == X"></if>

This doesn't work because it's basically going to display the image based on whether or not the reader is in X usergroup. I need one that determines whether the poster is in X usergroup.

kh99
11-29-2011, 12:22 AM
That should work. $post['usergroupid'] will be the usergroupid of the poster.

Cledus James
11-29-2011, 12:27 AM
It's not. Not sure why it isn't then. Maybe it's because the usergroup Im basing it on is a custom group and not a default one? No idea. The group id is 80 so I added this code within my postbit template:

<if condition="$post['usergroupid'] == 80">hello</if>

It would not print the "hello". Any ideas for me?

Thanks for all the help.

kh99
11-29-2011, 12:51 AM
Is it a secondary (additional) user group? If so (and even if it's not, really), you should use

<if condition="is_member_of($post, 80)">hello</if>

Cledus James
11-29-2011, 02:20 AM
That worked, thanks for your help.