• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XenOption inside of ismemberof conditional?

#1
Im trying to get a variable inside of another variable to work. Any ideas?
Code:
<xen:if is="{xen:helper ismemberof, $visitor, {$xenOptions.permissions}}">
 

Jake Bunce

XenForo moderator
Staff member
#4
Multiple groups must be specified like this:

http://xenforo.com/community/threads/usergroup-checking-in-the-templates.9447/#post-282874

A variable like {$xenOptions.permissions} can only represent one group, not multiple. Multiple groups must be separate parameters. To clarify, these two are very different:

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 2, 3, 4}">
Code:
<xen:if is="{xen:helper ismemberof, $visitor, '2,3,4'}">
I suspect you might be attempting the latter by way of {$xenOptions.permissions} which does not work. Each group must be a separate parameter. You can't use a single string parameter to specify multiple groups.
 
#5
<xen:if is="{xen:helper ismemberof, $visitor, {$xenOptions.permissions}}">
I have $xenOptions.permissions set to 1, 2, 3 but it is not working. What could I do to get it to recognize it altogether instead of just the 1st character?
 

Jake Bunce

XenForo moderator
Staff member
#6

Jake Bunce

XenForo moderator
Staff member
#8
vB has never allowed explode() in template syntax. But it does allow an array of ids to be used in this circumstance, unlike XF. That's what my suggestion is about.
 

Jake Bunce

XenForo moderator
Staff member
#10
Absolutely you can use explode() in PHP. But we are working with template syntax. You can write an addon to do your group checking using PHP code instead of template code.
 
#11
But unlike vb I used the variable I set up with the explode to be referred back to in template.
<php>
$usergroups = explode();
</php>

<xen:if is="{xen:helper ismemberof, $visitor, $usergroups}">
 
#13
Im just not use to the whole requiring a listener. Im use to just putting the code that I need in the xml. How would I go about the permission for the mod without the passing of arrays?