aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-12-05 13:21:59 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-12-05 13:21:59 +0000
commit0be8d74f64120aed982243a18f1753f4d032c7ea (patch)
treed0ff71b33153635595234421208fe0eebe2a225d
parente55ceab7fa988be50c4db00df6a3ca724c1405a1 (diff)
downloadelgg-0be8d74f64120aed982243a18f1753f4d032c7ea.tar.gz
elgg-0be8d74f64120aed982243a18f1753f4d032c7ea.tar.bz2
Closes #597: GUID must now be non-zero for messages to be sent
git-svn-id: https://code.elgg.org/elgg/trunk@2509 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/notification.php64
1 files changed, 33 insertions, 31 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 7f7238daa..1432979b6 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -86,40 +86,42 @@
// Results for a user are...
$result[$guid] = array();
- // Are we overriding delivery?
- $methods = $methods_override;
- if (!$methods)
- {
- $tmp = (array)get_user_notification_settings($guid);
- $methods = array();
- foreach($tmp as $k => $v)
- if ($v) $methods[] = $k; // Add method if method is turned on for user!
- }
-
- if ($methods)
- {
- // Deliver
- foreach ($methods as $method)
+ if ($guid) { // Is the guid > 0?
+ // Are we overriding delivery?
+ $methods = $methods_override;
+ if (!$methods)
{
- // Extract method details from list
- $details = $NOTIFICATION_HANDLERS[$method];
- $handler = $details->handler;
+ $tmp = (array)get_user_notification_settings($guid);
+ $methods = array();
+ foreach($tmp as $k => $v)
+ if ($v) $methods[] = $k; // Add method if method is turned on for user!
+ }
- if ((!$NOTIFICATION_HANDLERS[$method]) || (!$handler))
- throw new NotificationException(sprintf(elgg_echo('NotificationException:NoHandlerFound'), $method));
-
- if ($CONFIG->debug)
- error_log("Sending message to $guid using $method");
-
- // Trigger handler and retrieve result.
- $result[$guid][$method] = $handler(
- $from ? get_entity($from) : NULL, // From entity
- get_entity($guid), // To entity
- $subject, // The subject
- $message, // Message
- $params // Params
- );
+ if ($methods)
+ {
+ // Deliver
+ foreach ($methods as $method)
+ {
+ // Extract method details from list
+ $details = $NOTIFICATION_HANDLERS[$method];
+ $handler = $details->handler;
+ if ((!$NOTIFICATION_HANDLERS[$method]) || (!$handler))
+ throw new NotificationException(sprintf(elgg_echo('NotificationException:NoHandlerFound'), $method));
+
+ if ($CONFIG->debug)
+ error_log("Sending message to $guid using $method");
+
+ // Trigger handler and retrieve result.
+ $result[$guid][$method] = $handler(
+ $from ? get_entity($from) : NULL, // From entity
+ get_entity($guid), // To entity
+ $subject, // The subject
+ $message, // Message
+ $params // Params
+ );
+
+ }
}
}
}