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

Checking User (PHP & SQL)

Hey guyes,

So I'm new to XenForo developing but I'd like to check if a column in sql is set to 1 or 0
And the check should be on every page load.

Any idea how I can do this without creating a addon?

Thanks for your reply.
But that's not it, I know how to code it, I just need to know how can I make xenforo check it every page request without modifying xenforo files.


Jim Boy

Well-known member
You need some sort of add-on creation - that is just how XF manages it.

But in super simple steps one way of doing this is:

1. Put XF in debug mode
2. Go to development tools
3. Go to code event listneres and add a listener
4. In 'Listen to Event', choose 'Template Create'
5. In 'event hint', choose 'PAGE_CONTAINER'
6.In Execute Call back put a rerference to your code file eg 'myAddOn_Listener' would equate to /library/myAddOn/Listener.php
7 In the medthod box (after the "::") put your function called, eg 'listen'
8 put you code in the file - take note of the Callback Signature info, you need it, eg
class myAddOn_Listener
    public static function listen(&$templateName, array &$params, XenForo_Template_Abstract $template)
        // do some code