Testing for ACP

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

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?
David
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
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 » 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
3Di
Registered User
Posts: 12886
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

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

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 14 guests