]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Handle case if get_user_notification_settings() returns false
authorSteve Clay <steve@mrclay.org>
Sun, 8 Dec 2013 00:27:18 +0000 (19:27 -0500)
committerSteve Clay <steve@mrclay.org>
Sun, 8 Dec 2013 00:34:54 +0000 (19:34 -0500)
engine/lib/notification.php

index b6399b3c6a97f5b699c4ae7141c021078f38862c..2506867d58264981f32a6fe78662fb2fdf54b9cf 100644 (file)
@@ -110,12 +110,15 @@ function notify_user($to, $from, $subject, $message, array $params = NULL, $meth
                        // Are we overriding delivery?
                        $methods = $methods_override;
                        if (!$methods) {
-                               $tmp = (array)get_user_notification_settings($guid);
+                               $tmp = get_user_notification_settings($guid);
                                $methods = array();
-                               foreach ($tmp as $k => $v) {
-                                       // Add method if method is turned on for user!
-                                       if ($v) {
-                                               $methods[] = $k;
+                               // $tmp may be false. don't cast
+                               if (is_array($tmp)) {
+                                       foreach ($tmp as $k => $v) {
+                                               // Add method if method is turned on for user!
+                                               if ($v) {
+                                                       $methods[] = $k;
+                                               }
                                        }
                                }
                        }