From 283a7758eaae7a4f8f1165eb7d31f2a60c32edea Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 27 Jun 2008 10:21:06 +0000 Subject: Fixes #100 - User not having any notification method no longer a hard error. git-svn-id: https://code.elgg.org/elgg/trunk@1162 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/notification.php | 49 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'engine/lib/notification.php') diff --git a/engine/lib/notification.php b/engine/lib/notification.php index c5b3cacf1..c88d29f1c 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -96,33 +96,32 @@ if ($v) $methods[] = $k; // Add method if method is turned on for user! } - if ((!$methods) || (count($methods)==0)) - throw new NotificationException(elgg_echo('NotificationException:NoNotificationMethod')); - - // Deliver - foreach ($methods as $method) + if ($methods) { - // 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 - ); + // 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 + ); + + } + } } return $result; -- cgit v1.2.3