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

XF 1.3 If statement with multiple usergroups

Discussion in 'Styling and Customization Questions' started by i_n_k, Apr 16, 2014.

  1. i_n_k

    i_n_k Member

    I'm trying to figure out the conditional statements behind showing an item based on if people are not part of a particular usergroup.

    In other words:

    <if usergroup != "this group">

    Show script

    </end if>

    Guessing it's really easy, but haven't been able to dig it out via search? :confused:
  2. Luis

    Luis Well-Known Member

  3. i_n_k

    i_n_k Member

    Yes, I found that, definitely an excellent resource :D

    Now the issue I'm having is how do you institute that within a template being inserted via a callback? The conditional isn't being recognized, so I'm at a bit of a loss as to how best to handle it. Still figuring things out here :)
  4. i_n_k

    i_n_k Member

    Still having an issue

    I'm Using:

    <xen:if is="!{xen:helper ismemberof, $visitor, 3}">
    Output text

    Which Gives me:

    Template Errors:
    1. Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be an array, null given in /httpdocs/test-forum/library/XenForo/Template/Helper/Core.php
    2. Argument 1 passed to XenForo_Model_User::isMemberOfUserGroup() must be an array, null given, called in /httpdocs/test-forum/library/XenForo/Template/Helper/Core.php and defined in /httpdocs/test-forum/library/XenForo/Model/User.php
    I'm testing it out using the id 3 (the administrator ID), which I found using this method:
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Where are you entering the conditional statement and script code?
  6. i_n_k

    i_n_k Member

    Hi Brogan, thank you for taking the time. In this particular case I'm entering the conditional statement in inside the "template modification" editor, and that's resulting in the error posted above.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Can you post some screenshots?

    I will try and duplicate what it is you are attempting.
  8. i_n_k

    i_n_k Member

    Hi Brogan,

    Sure, I've attached them. I've got the screenshot where the code is being inserted, and then the resulting error at the top of the forum.

    Attached Files:

  9. i_n_k

    i_n_k Member

    Hey Brogan,

    Just following up to see if you had any thoughts on this?
  10. Brogan

    Brogan XenForo Moderator Staff Member

    Can you copy and past everything in the Replace field.
    Some of it is truncated so I want to make sure I use the same.

    Have you used $0 at the start of the Replace field to insert the content?

Share This Page