Events are triggered by the Elgg framework when a certain thing happens - for example when a blog post is created or when a pingback is received.
By listening to events your plugin can opt to have code executed when that event occurs.
To register a hook, use the function 'register_elgg_event_handler', eg.
register_elgg_event_handler('init','system','entities_init');
Parameters
register_elgg_event_handler('init','system','entities_init');
Your event handler should have the following prototype:
function event_handler_function($event, $object_type, $object)
{
... do stuff ...
}
This function MUST return true or false depending on success. A false will halt the event in its tracks and no more functions will be called.
Parameters
Elgg has three special events that occur on (virtually) every pageload.
Boot
System boot connects to the database, starts the session, and establishes some base variables and configuration settings. This event is inaccessible to plugins, as it is triggered before plugins are loaded.
Init
This event is intended for plugins to perform configuration procedures. It is recommended that you add submenu items and perform similar activities in a yourplugin_init function attached to this event.
Pagesetup
Sometimes it's necessary to perform further procedures after the full Elgg framework has been loaded, but before anything has been drawn to the page. This event is called during the first reference to elgg_view (whether directly or through a helper function like elgg_view_title or list_entities).
event handler, events, event system
Last updated 531 days ago by Pete Harris

Roger Curry
Profile
Friends
Friends of
Pages
Plugins
Is it possible to override the pagesetup event? Specifically, I'd like to override the event so that the users_pagesetup function in engine/lib/users.php doesn't fire. I see that the priority affects the order the handlers are being executed, but returning false does not seem to prevent additional functions from being executed. I changed the priority of the users_pagesetup handler from 0 to 1 (modifying users.php), and registered my event handler with priority 0, this resulted in my handler firing first - as expected. My event handler returns false but the users_pagesetup function still fires. Any thoughts?
Roger Curry 504 days ago