We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Call an Extension on Every Page Load

Development and Programming

blendimc's avatar
blendimc
150 posts
14 years ago
blendimc's avatar blendimc

I would like to create a pretty extensive extension that would need to run on every single control panel page. Is there a hook for that or some better way to accomplish this function?

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

At what point in the page load would you need to execute code?

Off the top of my head I’d suggest looking at the sessions_end hook.

       
blendimc's avatar
blendimc
150 posts
14 years ago
blendimc's avatar blendimc

I forgot to mention that. Its a permission type extension, so if the page was not supposed to be displayed, I would want to prevent the page from displaying and redirect to another screen.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

The sessions_end hook is executed on every single page load (front and back end) so you can execute whatever code you want there processing your permissions code.

       
blendimc's avatar
blendimc
150 posts
14 years ago
blendimc's avatar blendimc

Thanks!

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

If you only need to use this code in the CP you should also consider adding a wrapping conditional around your required code which checks if the page load is a CP page.

public function sessions_end()
{
   if (REQ == 'CP')
   {
       // your code here
   }
}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.