diff options
Diffstat (limited to 'actions/notifications')
-rw-r--r-- | actions/notifications/settings/usersettings/save.php | 13 |
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 +} |