XF 1.3 Conditional for multiple usergroups in message template

Michael

Active member
Hi guys I am wanting to include multiple usergroups with this conditional instead of the single usergroup, how do I go about it?

Code:
<xen:if is="{xen:helper ismemberof, $message, 40}">
Thank you.
 

Rudy

Well-known member
This is somewhat similar, although what I want to do is allow usergroup ID 20 to view something, yet if they are also in usergroup IP 36, to not view the content. We have a forum section which is automatically promoted after a given number of posts (promoting them to usergroup 20), yet we can revoke that by selection of secondary usergroup 36. The reason I do this is mainly so we can temporarily disable access without interfering with the automatic promotion of a member to usergroup 20. In short, 20 is automatic, and 36 revokes 20.

I'm not sure if using an AND would be more appropriate, or some sort of IF/ELSEIF/ELSE loop.

I tried this:

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 20} AND !{xen:helper ismemberof, $visitor, 36}">
<p>show this</p>
</xen:if>
but the text still appears, and I get this error:

Code:
Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be an array, null given in /usr/www/.../xf/library/XenForo/Template/Helper/Core.php, line 1344
Argument 1 passed to XenForo_Model_User::isMemberOfUserGroup() must be an array, null given, called in /usr/www/.../xf/library/XenForo/Template/Helper/Core.php on line 1352 and defined in /usr/www/.../xf/library/XenForo/Model/User.php, line 1683
Seeing the note about using $visitor vs. $user, I changed the above instances to $user.

Code:
<xen:if is="{xen:helper ismemberof, $user, 20} AND !{xen:helper ismemberof, $user, 36}">
<p>show this</p>
</xen:if>
Now, the text does not appear in either case, and I still get the error message.

Is it possible these template conditionals are not supported where I am trying to use them? I am trying to control viewing of a link in the membercard, along with a link in the user's drop-down menu, using conditionals but have had no luck as of yet. If they're not possible in these instances, then I can stop beating my head against the wall over this.
 
Top