Testing for ACP

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Registered User
Posts: 16093
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood

Testing for ACP

Post by david63 » Mon May 07, 2018 10:34 am

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?
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Registered User
Posts: 158
Joined: Thu Aug 18, 2011 2:41 pm
Location: Le Mans, France
Name: Yohan

Re: Testing for ACP

Post by Zoddo » Mon May 07, 2018 10:44 am

By checking the IN_ADMIN constant

Code: Select all

if (defined('IN_ADMIN'))
	// code to execute if you are in the acp

User avatar
Former Team Member
Posts: 13686
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco

Re: Testing for ACP

Post by 3Di » Mon May 07, 2018 11:34 pm

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)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Post Reply

Return to “Extension Writers Discussion”