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

If the xen:username is in a group...

Discussion in 'XenForo Development Discussions' started by MichaelDance, Apr 20, 2014.

  1. MichaelDance

    MichaelDance Well-Known Member

    I'm stuck doing a addon, is there a way to check if the <xen:username> is in a certain group?
     
  2. AndyB

    AndyB Well-Known Member

    Is this for a permission?
     
  3. MichaelDance

    MichaelDance Well-Known Member

    Yes mate, so say if the user who has posted is in a certain group, it will display a icon however if they aren't in that group it doesn't show anything. I've got the helper sorted. Just stuck on trying to get it to displayed if the user has the group. :)
     
  4. AndyB

    AndyB Well-Known Member

    Perhaps this will work:

    PHP:
    if (XenForo_Visitor::getInstance()->hasPermission('addonGroupID''addonID'))
    {
       
    // do something
    }
     
  5. MichaelDance

    MichaelDance Well-Known Member

    Would that go in the listener file mate?
     
  6. AndyB

    AndyB Well-Known Member

    No the listerner is only used to point to another file.

    The code I posted would go in the PHP file you are extending.
     
  7. MichaelDance

    MichaelDance Well-Known Member

    Ah I see I need a php file with a extend a template :) Thank you mate for that code just need to work out how to do that file now :)
     

Share This Page