From 0be8d74f64120aed982243a18f1753f4d032c7ea Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 5 Dec 2008 13:21:59 +0000 Subject: 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 --- engine/lib/notification.php | 64 +++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'engine') 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 + ); + + } } } } -- cgit v1.2.3