xfpoint

How to Enable Debug Mode in XenForo Only for Admins

What is Debug Mode in XenForo?

Debug mode as the name suggest opens up an option to debug issues related to page loads time with the explanation of all the queries executed in rendering the output. It can immensely help to optimize SQL queries.

And helps in creating a XenForo add-ons with an extra development tabs under the admin area.

And if you don’t have the debug mode enabled, you may not be able to edit the master templates, admin templates or even edit the template modifications from other addons and can only enable/disable each template modifications.

How to Enable Debug Mode?

Enabling debug mode in XenForo is very simple and all you have to do is add the following line of code in the config.php file under the library folder of the forum root directory.


Note: This may be good for a development environment or staging environment but it may not be ideal to enable debug mode on a live site for everybody.

Addon to Enable Debug Mode

If you aren’t comfortable adding that line of code in the config.php file, there is this addon that can do exactly the same thing for you.

Now clicking the checkbox is good enough to enable the debug mode.

On a live site, only for few minutes, enabling debug mode via an addon is convenient instead of opening up an FTP program, browse to the library folder to locate the config.php file, open up to edit the file in an editor and then upload the file using the same FTP program. Once you are done with the debug options, you may again want to undo the config file changes and resave it.

Using add-on is as simple as clicking a checkbox and then unchecking it.

Note: The addon like config file will enable the debug mode for anyone visiting the site and does not take into account any conditional enabling of debug mode.

How To Enable Debug Mode Only For Selected Users and Without Any Addons?

Debug mode can’t be enabled based on admin permissions because permission set isn’t fetched when the config file is included. So restrict of debug mode for admins will be based on IP address.

Ask Google what’s your IP address or visit WhatsMyIp.org


Now put the following code in the config.php file to enable the debug mode for selected IP.

Change the IP address to your IP address. If you wish to enable debug mode for multiple IP addresses, use

Add every IP as comma separated string to enable debug mode for each of the IP address.

Exit mobile version