aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/notifications/settings/usersettings/save.php13
-rw-r--r--actions/user/default_access.php4
2 files changed, 11 insertions, 6 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
+}
diff --git a/actions/user/default_access.php b/actions/user/default_access.php
index 0aacf209c..845e1fbfc 100644
--- a/actions/user/default_access.php
+++ b/actions/user/default_access.php
@@ -24,8 +24,8 @@ if ($CONFIG->allow_user_default_access) {
if ($user) {
$current_default_access = $user->getPrivateSetting('elgg_default_access');
- if ($default_access != $current_default_access) {
- if ($user->setPrivateSetting('elgg_default_access',$default_access)) {
+ if ($default_access !== $current_default_access) {
+ if ($user->setPrivateSetting('elgg_default_access', $default_access)) {
system_message(elgg_echo('user:default_access:success'));
} else {
register_error(elgg_echo('user:default_access:fail'));