diff options
Diffstat (limited to 'actions/notifications/settings/usersettings')
| -rw-r--r-- | actions/notifications/settings/usersettings/save.php | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/actions/notifications/settings/usersettings/save.php b/actions/notifications/settings/usersettings/save.php index fe6a64b93..455a444e1 100644 --- a/actions/notifications/settings/usersettings/save.php +++ b/actions/notifications/settings/usersettings/save.php @@ -1,37 +1,29 @@ <?php - /** - * Elgg notifications user preference save acion. - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008 - * @link http://elgg.org/ - */ +/** + * Elgg notifications user preference save acion. + * + * @package Elgg + * @subpackage Core + */ - // Method - $method = get_input('method'); - gatekeeper(); - - $result = false; - foreach ($method as $k => $v) - { - $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false); - - if (!$result) - { - register_error(elgg_echo('notifications:usersettings:save:fail')); - //forward($_SERVER['HTTP_REFERER']); - - //exit; - } +$method = get_input('method'); + +$current_settings = get_user_notification_settings(); + +$result = false; +foreach ($method as $k => $v) { + // check if setting has changed and skip if not + if ($current_settings->$k == ($v == 'yes')) { + continue; } - - if ($result) - system_message(elgg_echo('notifications:usersettings:save:ok')); - else + + $result = set_user_notification_setting(elgg_get_logged_in_user_guid(), $k, ($v == 'yes') ? true : false); + + if (!$result) { register_error(elgg_echo('notifications:usersettings:save:fail')); - - //forward($_SERVER['HTTP_REFERER']); -?>
\ No newline at end of file + } +} + +if ($result) { + system_message(elgg_echo('notifications:usersettings:save:ok')); +} |
