Actions
Actions are generally requests to update the data model. Examples include posting a comment, deleting a blog post, or joining a group.
Action handlers are registered by mapping a portion of a URL to a script:
elgg_register_action('blog/save', "$action_path/save.php");
The save.php
script is included (executed) by the function action()
when a request is made against the /action/blog/save/
URL.
The normal flow of an action handler is as follows:
- Access user-submitted data using
get_input()
. - Validate data.
- Update data model.
- Queue status message using
system_message()
orregister_error()
. - Forward the requester to a page handler using
forward()
.
Code location
Core action handlers: /actions/
Plugin action handlers: /mod/<plugin name>/actions/
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.