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

How to examine the current user inside templateHook listener

Discussion in 'XenForo Development Discussions' started by AA7BQ, Jul 25, 2015.

  1. AA7BQ

    AA7BQ Member

    I'm looking for the best practice for looking at the current user from within my templateHook event listener. My goal is to examine their secondary_group_ids t make decisions on which content to display.

    It seems like the user's information should already be available somewhere without having to perform a database query. What's the best way?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    PHP:
    $visitor XenForo_Visitor::getInstance();
    $secondaryGroupIds $visitor->secondary_group_ids;
     
    Thomas.B likes this.
  3. AA7BQ

    AA7BQ Member

    Thanks Chris, that was just what I was looking for.
     

Share This Page