XF 1.3 Conditional Help


Active member
Hello! I have a conditional in my message_user_info template to show a different graphic based on what usergroup the user is in. Unfortunately, it's not quite working out the way it should.

            <xen:if is="{xen:helper ismemberof, $user, 7}">
                            <img src="styles/jagger/groupimages/user_CascadeBay.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 8}" />
                            <img src="styles/jagger/groupimages/user_PandoraTown.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 13}" />
                            <img src="styles/jagger/groupimages/user_Horizon.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 12}" />
                            <img src="styles/jagger/groupimages/user_Morhall.png" />
                       <xen:elseif is="{xen:helper ismemberof, $user, 11}" />
                            <img src="styles/jagger/groupimages/user_MistyHollow.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 15}" />
                            <img src="styles/jagger/groupimages/user_Vagabond.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 5}" />
                            <img src="styles/jagger/groupimages/newcomer_icon.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 4}" />
                            <img src="styles/jagger/groupimages/mod_icon.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 3}" />
                            <img src="styles/jagger/groupimages/admin_icon.png" />
                        <xen:elseif is="{xen:helper ismemberof, $user, 6}" />
                            <img src="styles/jagger/groupimages/ooc_icon.png" />
                        <xen:else />
                            <img src="styles/jagger/groupimages/visitor_icon.png" />
On my forum, every user is part of the basic registered group as their primary usergroup. I then assign any other appropriate groups as secondary usergroups (just one secondary group per user).

The above mostly works until I get down to the last two conditionals.

I have a user with no secondary usergroups. However, they are given the usergroup icon for usergroup 6 (ooc_icon.png). I've double-checked their usergroups to make sure they don't have that usergroup assigned as either primary or secondary. This is true of every account without a secondary usergroup assigned, though the problem seems to come and go when I rebuild the user cache.

Is there just something I'm missing in my conditional or a better way to do this?

Jake Bunce

XenForo moderator
Staff member
The ismemberof helper checks these two user fields in the database:


With respect to groups, the cache rebuild only updates the xf_user_group_relation table which is not directly involved in that template helper. The rebuild shouldn't affect the result of that condition, so it's strange that you say it does.

I recommend double checking the values in those user columns in the database.