aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/notification.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 10:21:06 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 10:21:06 +0000
commit283a7758eaae7a4f8f1165eb7d31f2a60c32edea (patch)
treef865c997385877fd5ff50113aecf1ea408a4c8fa /engine/lib/notification.php
parent5bbd8934a52aa3f76ca51b3d1232b735d5872890 (diff)
downloadelgg-283a7758eaae7a4f8f1165eb7d31f2a60c32edea.tar.gz
elgg-283a7758eaae7a4f8f1165eb7d31f2a60c32edea.tar.bz2
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
Diffstat (limited to 'engine/lib/notification.php')
-rw-r--r--engine/lib/notification.php49
1 files changed, 24 insertions, 25 deletions
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;