Help with showing content to certain usergroups

gldtn

Well-known member
Hello guys, I'm trying to show a certain piece of code using this:

Code:
<xen:if is="{xen:helper ismemberof, $user, x} AND {$user.is_admin} OR {$user.is_moderator}">

CODE HERE

</xen:if>

But I get:
emplate Errors: PAGE_CONTAINER

  1. Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be an array, null givenin /home/user/public_html/forumdir/library/XenForo/Template/Helper/Core.php, line 1028:
    1027: } 1028: $__compilerVar41 .= ' 1029: </span>
  2. Argument 1 passed to XenForo_Model_User::isMemberOfUserGroup() must be an array, null given, called in /home/user/public_html/forumdir/library/XenForo/Template/Helper/Core.php on line 1030 and definedin /home/user/public_html/forumdir/library/XenForo/Model/User.php, line 1308:
    1307: </div> 1308: <ul class="secondaryContent blockLinksList"> 1309: ';



Any ideas?
 
Change your condition to this:

Code:
<xen:if is="{xen:helper ismemberof, $visitor, x} OR {$visitor.is_admin} OR {$visitor.is_moderator}">

</xen:if>

You were using AND which is not correct for what you want.
 
Hi Jake, in your opinion, why this conditional don't work? :(

Code:
<xen:if is="{xen:helper ismemberof, $user, 39}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/01.png"></span>
<xen:elseif is="{xen:helper ismemberof, $user, 40}" />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/02.png"></span>
<xen:elseif is="{xen:helper ismemberof, $user, 36}" />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/03.png"></span>
<xen:elseif is="{xen:helper ismemberof, $user, 35}" />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/04.png"></span>
<xen:elseif is="{xen:helper ismemberof, $user, 41}" />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/05.png"></span>
<xen:elseif is="{xen:helper ismemberof, $user, 42}" />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/06.png"></span>
<xen:else />
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/00.png"></span>
</xen:if>
 
That code looks to be showing different images based on usergroup
Exactly.
The code is inserted in message_user_info and show a different progress bar based on user group.

My idea was a case-of logic structure and not a mere if-then, but I don't found switch or case in xenforo syntax...
How can I do?

Thanks :)
 
Did you intend to show multiple images for individual users? Try this:

Code:
<xen:if is="{xen:helper ismemberof, $user, 39}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/01.png"></span>
</xen:if>

<xen:if is="{xen:helper ismemberof, $user, 40}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/02.png"></span>
</xen:if>

<xen:if is="{xen:helper ismemberof, $user, 36}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/03.png"></span>
</xen:if>

<xen:if is="{xen:helper ismemberof, $user, 35}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/04.png"></span>
</xen:if>

<xen:if is="{xen:helper ismemberof, $user, 41}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/05.png"></span>
</xen:if>

<xen:if is="{xen:helper ismemberof, $user, 42}">
    <span style="padding-left:5px;"><img src="styles/immobilio/rank/06.png"></span>
</xen:if>
 
No Jack, I need to display one badge for each specific user group.

I can do this with a series of if like you've suggested.

My intention is to find a logic structure more sophisticated like a case in php language for instance.
 
Top Bottom