cms:onApplyPageSecurity event
The cms:onApplyPageSecurity event allows to perform security check before a page is displayed. Inside the event handler you can check different conditions and redirect a browser to another page if it is needed. The event handler should accept 2 parameters - the page object (Cms_Page) or the array containing URL segments.
Event handler example:
public function subscribeEvents()
{
Backend::$events->addEvent('cms:onApplyPageSecurity', $this, 'apply_page_security');
}
public function apply_page_security($page, $params)
{
$customer = Cms_Controller::get_customer();
if ($page->url == '/special_page' && !$customer)
Phpr::$response->redirect(root_url('/'));
}
Next: shop:onCustomerCreated event
Previous: cms:onAfterDisplay event
Return to Handling LemonStand events

