aboutsummaryrefslogtreecommitdiff
path: root/actions/notifications/settings/usersettings/save.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 23:15:43 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 23:15:43 +0000
commit60c1387a16ea4944674b0c9da2273158d1fbf0b4 (patch)
tree6f94aaf77a7d794f489212ff50f08f5211a18126 /actions/notifications/settings/usersettings/save.php
parentca08eb6d170d375ef4fca53604956f3474c7db19 (diff)
downloadelgg-60c1387a16ea4944674b0c9da2273158d1fbf0b4.tar.gz
elgg-60c1387a16ea4944674b0c9da2273158d1fbf0b4.tar.bz2
Merged r6757:6810 from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6850 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/notifications/settings/usersettings/save.php')
-rw-r--r--actions/notifications/settings/usersettings/save.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/actions/notifications/settings/usersettings/save.php b/actions/notifications/settings/usersettings/save.php
index 159dd501b..7df0e7e5c 100644
--- a/actions/notifications/settings/usersettings/save.php
+++ b/actions/notifications/settings/usersettings/save.php
@@ -12,9 +12,16 @@
$method = get_input('method');
gatekeeper();
+$current_settings = get_user_notification_settings();
+
$result = false;
foreach ($method as $k => $v) {
- $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false);
+ // check if setting has changed and skip if not
+ if ($current_settings->$k == ($v == 'yes')) {
+ continue;
+ }
+
+ $result = set_user_notification_setting(get_loggedin_userid(), $k, ($v == 'yes') ? true : false);
if (!$result) {
register_error(elgg_echo('notifications:usersettings:save:fail'));
@@ -23,6 +30,4 @@ foreach ($method as $k => $v) {
if ($result) {
system_message(elgg_echo('notifications:usersettings:save:ok'));
-} else {
- register_error(elgg_echo('notifications:usersettings:save:fail'));
-} \ No newline at end of file
+}