aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 074204310..021af5e48 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1637,6 +1637,22 @@ function register_elgg_event_handler($event, $object_type, $function, $priority
}
/**
+ * Unregisters a function to a particular kind of event
+ *
+ * @param string $event The event type
+ * @param string $object_type The object type
+ * @param string $function The function name
+ */
+function unregister_elgg_event_handler($event, $object_type, $function) {
+ global $CONFIG;
+ foreach($CONFIG->events[$event][$object_type] as $key => $event_function) {
+ if ($event_function == $function) {
+ unset($CONFIG->events[$event][$object_type][$key]);
+ }
+ }
+}
+
+/**
* Alias function for events, that triggers a particular kind of event
*
* @param string $event The event type
@@ -1704,6 +1720,22 @@ function register_plugin_hook($hook, $entity_type, $function, $priority = 500) {
}
/**
+ * Unregister a function to a plugin hook for a particular entity type
+ *
+ * @param string $hook The name of the hook
+ * @param string $entity_type The name of the type of entity (eg "user", "object" etc)
+ * @param string $function The name of a valid function to be run
+ */
+function unregister_plugin_hook($hook, $entity_type, $function) {
+ global $CONFIG;
+ foreach($CONFIG->hooks[$hook][$entity_type] as $key => $hook_function) {
+ if ($hook_function == $function) {
+ unset($CONFIG->hooks[$hook][$entity_type][$key]);
+ }
+ }
+}
+
+/**
* Triggers a plugin hook, with various parameters as an array. For example, to provide
* a 'foo' hook that concerns an entity of type 'bar', with a parameter called 'param1'
* with value 'value1', that by default returns true, you'd call: