XenOption inside of ismemberof conditional?

IFeelYourPain13

Active member
Im trying to get a variable inside of another variable to work. Any ideas?
Code:
<xen:if is="{xen:helper ismemberof, $visitor, {$xenOptions.permissions}}">
 
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.
 
<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?
 
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.
 
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.
 
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}">
 
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?
 
Top Bottom