actions.rst 1.4 KB

123456789101112131415161718192021
  1. Actions
  2. #######
  3. Actions are the primary way users interact with an Elgg site.
  4. .. toctree::
  5. :maxdepth: 2
  6. Overview
  7. ========
  8. An action in Elgg is the code that runs to make changes to the database when a user does something. For example, logging in, posting a comment, and making a blog post are actions. The action script processes input, makes the appropriate modifications to the database, and provides feedback to the user about the action.
  9. Action Handler
  10. ==============
  11. Actions are registered during the boot process by calling ``elgg_register_action()``. All actions URLs start with ``action/`` and are served by Elgg's front end controller through the action service. This approach is different from traditional PHP applications that send information to a specific file. The action service performs :doc:`CSRF security checks </design/security>`, and calls the registered action script file, then optionally forwards the user to a new page. By using the action service instead of a single script file, Elgg automatically provides increased security and extensibility.
  12. In Elgg 1.8 and before, actions were handled by an action handler script in ```engine/handlers/action_handler.php``. This required specific rewrite rules for URLs beginning with ``/action/``.
  13. See :doc:`/guides/actions` for details on how to register and construct an action. To look at the core actions, check out the directory /actions.