aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 6a15f2e9a..90cd11360 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -682,16 +682,18 @@
$CONFIG->hooks = array();
} else if (!isset($CONFIG->hooks[$hook]) && !empty($hook)) {
$CONFIG->hooks[$hook] = array();
+ } else if (!isset($CONFIG->hooks[$hook][$entity_type]) && !empty($entity_type)) {
+ $CONFIG->hooks[$hook][$entity_type] = array();
}
- if (!empty($hook) && is_callable($function)) {
+ if (!empty($hook) && !empty($entity_type) && is_callable($function)) {
$priority = (int) $priority;
if ($priority < 0) $priority = 0;
- while (isset($CONFIG->hooks[$hook][$priority])) {
+ while (isset($CONFIG->hooks[$hook][$entity_type][$priority])) {
$priority++;
}
- $CONFIG->hooks[$hook][$priority] = $function;
- ksort($CONFIG->hooks[$hook]);
+ $CONFIG->hooks[$hook][$entity_type][$priority] = $function;
+ ksort($CONFIG->hooks[$hook][$entity_type]);
return true;
} else {
return false;