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

Errors when creating Event Listener

Discussion in 'XenForo Development Discussions' started by zkiller, Jun 10, 2012.

  1. zkiller

    zkiller Member

    So I created a Add-On called TeamSpeak and have a folder called TeamSpeak containing the Listener.php file in the folder Library. I also created a new template called teamspeak_sidebar. The code in Listener.php is as follows:

    Code:
    class TeamSpeak_Listener
    {
        public static function templateHook($hookName, &$contents, $params, XenForo_Template_Abstract $template)
        {
            if ($hookName == 'forum_list_sidebar')
            {
                $contents .= $template->create('teamspeak_sidebar');
            }
        }
    }
    
    When trying to create the Event Listener I get an Error stating "Please enter a valid callback method". I have run through this several times and have tried searching the forums to see what I am doing wrong here with no luck. Any ideas?
     

    Attached Files:

  2. Chris D

    Chris D XenForo Developer Staff Member

    I've just done this myself with your code and it works fine...

    All I can suggest is you make sure that you have a folder called TeamSpeak (case sensitive) in your library folder and also that Listener.php (also case sensitive) is in there.
     
    zkiller likes this.
  3. zkiller

    zkiller Member

    Stepped away for a few minutes and now it works. Odd. Thanks for your help though. :)
     
    Yorick likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Good to hear :)

    Anytime.
     

Share This Page