Events and hooks

Elgg's events and plugin hooks are an important part of the platform's extensibility. Plugins register functions that are called when an event occurs or a hook is triggered. Through these callback functions, plugins change or extend the functionality of Elgg's engine.

There is overlap between the functionality of events and plugin hooks. Broadly, they can be described as follows:

  • Elgg events notify the registered callback function that something has happened
  • Plugin hooks give callback functions the opportunity to change something that the core has done

The callback functions are called handlers, but do not confuse them with page handlers.

Elgg events

Event handlers are registered with the function elgg_register_event_handler():

elgg_register_event_handler('pagesetup', ...

Get Elgg 1.8 Social Networking now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.