events-list.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. List of events in core
  2. ######################
  3. .. contents:: Contents
  4. :local:
  5. :depth: 1
  6. System events
  7. =============
  8. **boot, system**
  9. First event triggered. Triggered before plugins have been loaded.
  10. **plugins_boot, system**
  11. Triggered just after the plugins are loaded. Rarely used. init, system is used instead.
  12. **init, system**
  13. Plugins tend to use this event for initialization (extending views, registering callbacks, etc.)
  14. **ready, system**
  15. Triggered after the ``init, system`` event. All plugins are fully loaded and the engine is ready
  16. to serve pages.
  17. **pagesetup, system**
  18. Called just before the first content is produced. Is triggered by ``elgg_view()``.
  19. **shutdown, system**
  20. Triggered after the page has been sent to the user. Expensive operations could be done here
  21. and not make the user wait.
  22. .. note:: Depending upon your server configuration the PHP output
  23. might not be shown until after the process is completed. This means that any long-running
  24. processes will still delay the page load.
  25. **regenerate_site_secret:before, system**
  26. Return false to cancel regenerating the site secret. You should also provide a message
  27. to the user.
  28. **regenerate_site_secret:after, system**
  29. Triggered after the site secret has been regenerated.
  30. **log, systemlog**
  31. Called for all triggered events. Used internally by ``system_log_default_logger()`` to populate
  32. the ``system_log`` table.
  33. **upgrade, system**
  34. Triggered after a system upgrade has finished. All upgrade scripts have run, but the caches
  35. are not cleared.
  36. **upgrade, upgrade**
  37. A single upgrade script finished executing. Handlers are passed a ``stdClass`` object with the properties
  38. * from - The version of Elgg upgrading from.
  39. * to - The version just upgraded to.
  40. **activate, plugin**
  41. Return false to prevent activation of the plugin.
  42. **deactivate, plugin**
  43. Return false to prevent deactivation of the plugin.
  44. **init:cookie, <name>**
  45. Return false to override setting a cookie.
  46. **cache:flush, system**
  47. Reset internal and external caches, by default including system_cache, simplecache, and memcache. One might use it to reset others such as APC, OPCache, or WinCache.
  48. User events
  49. ===========
  50. **login:before, user**
  51. Triggered during login. Returning false prevents the user from logging
  52. **login:after, user**
  53. Triggered after the user logs in.
  54. **logout:before, user**
  55. Triggered during logout. Returning false should prevent the user from logging out.
  56. **logout:after, user**
  57. Triggered after the user logouts.
  58. **validate, user**
  59. When a user registers, the user's account is disabled. This event is triggered
  60. to allow a plugin to determine how the user should be validated (for example,
  61. through an email with a validation link).
  62. **profileupdate, user**
  63. User has changed profile
  64. **profileiconupdate, user**
  65. User has changed profile icon
  66. **ban, user**
  67. Triggered before a user is banned. Return false to prevent.
  68. **unban, user**
  69. Triggered before a user is unbanned. Return false to prevent.
  70. **make_admin, user**
  71. Triggered before a user is promoted to an admin. Return false to prevent.
  72. **remove_admin, user**
  73. Triggered before a user is demoted from an admin. Return false to prevent.
  74. Relationship events
  75. ===================
  76. **create, relationship**
  77. Triggered after a relationship has been created. Returning false deletes
  78. the relationship that was just created.
  79. .. note:: This event was broken in Elgg 1.9 - 1.12.3, returning false would *not*
  80. delete the relationship. This is working as of 1.12.4
  81. **delete, relationship**
  82. Triggered before a relationship is deleted. Return false to prevent it
  83. from being deleted.
  84. **join, group**
  85. Triggered after the user ``$params['user']`` has joined the group ``$params['group']``.
  86. **leave, group**
  87. Triggered before the user ``$params['user']`` has left the group ``$params['group']``.
  88. Entity events
  89. =============
  90. **create, <entity type>**
  91. Triggered for user, group, object, and site entities after creation. Return false to delete entity.
  92. **update, <entity type>**
  93. Triggered before an update for the user, group, object, and site entities. Return false to prevent update.
  94. **update:after, <entity type>**
  95. Triggered after an update for the user, group, object, and site entities.
  96. **delete, <entity type>**
  97. Triggered before entity deletion. Return false to prevent deletion.
  98. **disable, <entity type>**
  99. Triggered before the entity is disabled. Return false to prevent disabling.
  100. **disable:after, <entity type>**
  101. Triggered after the entity is disabled.
  102. **enable, <entity type>**
  103. Return false to prevent enabling.
  104. **enable:after, <entity type>**
  105. Triggered after the entity is enabled.
  106. Metadata events
  107. ===============
  108. **create, metadata**
  109. Called after the metadata has been created. Return false to delete the
  110. metadata that was just created.
  111. **update, metadata**
  112. Called after the metadata has been updated. Return false to *delete the metadata.*
  113. **delete, metadata**
  114. Called before metadata is deleted. Return false to prevent deletion.
  115. **enable, metadata**
  116. Called when enabling metadata. Return false to prevent enabling.
  117. **disable, metadata**
  118. Called when disabling metadata. Return false to prevent disabling.
  119. Annotation events
  120. =================
  121. **annotate, <entity type>**
  122. Called before the annotation has been created. Return false to prevent
  123. annotation of this entity.
  124. **create, annotation**
  125. Called after the annotation has been created. Return false to delete
  126. the annotation.
  127. **update, annotation**
  128. Called after the annotation has been updated. Return false to *delete the annotation.*
  129. **delete, annotation**
  130. Called before annotation is deleted. Return false to prevent deletion.
  131. **enable, annotation**
  132. Called when enabling annotations. Return false to prevent enabling.
  133. **disable, annotations**
  134. Called when disabling annotations. Return false to prevent disabling.
  135. River events
  136. ============
  137. **created, river**
  138. Called after a river item is created.
  139. Notes
  140. =====
  141. Because of bugs in the Elgg core, some events may be thrown more than once
  142. on the same action. For example, ``update, object`` is thrown twice.