Book Image

concrete5 Beginner's Guide

Book Image

concrete5 Beginner's Guide

Overview of this book

Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Hooking into core events


You've made it through a lot of different concrete5 features if you got to this point. We've changed the layout, added new styles, added new functionality, and even wrapped these things in a package.

However, what if you wanted to react to things happening in the concrete5 core? You want to know when a page has been added, a group deleted, or a new user added. All of that can be achieved by using events and concrete5 will tell you what's going on and let you execute custom code and even interrupt some processes.

Before you can start using events, you have to enable them. By default, they are not enabled, as most websites and website administrators don't need them and would be nothing but overhead.

To do this, you have to set the constant ENABLE_APPLICATION_EVENTS to true. Open config/site.php and insert the highlighted line:

<?php 
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'concrete5');
define('DB_PASSWORD', 'concrete5');
define('DB_DATABASE', 'concrete5...