Testing for ACP

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Testing for ACP

Post by david63 »

I am sure I have seen this somewhere but I cannot find it.

How do I test to see if I am in the ACP?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
Zoddo
Registered User
Posts: 158
Joined: Thu Aug 18, 2011 2:41 pm
Location: Le Mans, France
Name: Yohan
Contact:

Re: Testing for ACP

Post by Zoddo »

By checking the IN_ADMIN constant

Code: Select all

if (defined('IN_ADMIN'))
{
	// code to execute if you are in the acp
}
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Testing for ACP

Post by 3Di »

IN_ADMIN is set after the session is created.

In case, you should check also ADMIN_START.

(defined('ADMIN_START') && ADMIN_START) || (defined('IN_ADMIN') && IN_ADMIN)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Post Reply

Return to “Extension Writers Discussion”