diff options
-rw-r--r-- | actions/email/save.php | 22 | ||||
-rw-r--r-- | actions/notifications/settings/usersettings/save.php | 6 | ||||
-rw-r--r-- | actions/user/language.php | 4 | ||||
-rw-r--r-- | actions/user/name.php | 4 | ||||
-rw-r--r-- | actions/user/password.php | 6 | ||||
-rw-r--r-- | actions/usersettings/save.php | 21 | ||||
-rw-r--r-- | engine/lib/notification.php | 12 | ||||
-rw-r--r-- | engine/lib/users.php | 25 | ||||
-rw-r--r-- | settings/user/index.php | 6 | ||||
-rw-r--r-- | views/default/notifications/settings/usersettings.php | 11 | ||||
-rw-r--r-- | views/default/user/settings/email.php | 10 | ||||
-rw-r--r-- | views/default/user/settings/language.php | 10 | ||||
-rw-r--r-- | views/default/user/settings/name.php | 10 | ||||
-rw-r--r-- | views/default/user/settings/password.php | 10 | ||||
-rw-r--r-- | views/default/usersettings/form.php | 12 |
15 files changed, 91 insertions, 78 deletions
diff --git a/actions/email/save.php b/actions/email/save.php index 08fcc7647..79cc40c6d 100644 --- a/actions/email/save.php +++ b/actions/email/save.php @@ -25,19 +25,21 @@ $user = get_entity($user_id); if ($user) - { - $user->email = $email; - if ($user->save()) - { - request_email_validation($user->getGUID()); - system_message(elgg_echo('email:save:success')); + {
+ if ($user->email != $email) { + $user->email = $email; + if ($user->save()) + { + request_email_validation($user->getGUID()); + system_message(elgg_echo('email:save:success')); + } + else + system_message(elgg_echo('email:save:fail'));
} - else - system_message(elgg_echo('email:save:fail')); } else system_message(elgg_echo('email:save:fail')); - forward($_SERVER['HTTP_REFERER']); - exit; + //forward($_SERVER['HTTP_REFERER']); + //exit; ?>
\ No newline at end of file diff --git a/actions/notifications/settings/usersettings/save.php b/actions/notifications/settings/usersettings/save.php index 79970421a..2748a7150 100644 --- a/actions/notifications/settings/usersettings/save.php +++ b/actions/notifications/settings/usersettings/save.php @@ -22,9 +22,9 @@ if (!$result) { system_message(elgg_echo('notifications:usersettings:save:fail')); - forward($_SERVER['HTTP_REFERER']); + //forward($_SERVER['HTTP_REFERER']); - exit; + //exit; } } @@ -33,5 +33,5 @@ else system_message(elgg_echo('notifications:usersettings:save:fail')); - forward($_SERVER['HTTP_REFERER']); + //forward($_SERVER['HTTP_REFERER']); ?>
\ No newline at end of file diff --git a/actions/user/language.php b/actions/user/language.php index f6a815858..f0b91791e 100644 --- a/actions/user/language.php +++ b/actions/user/language.php @@ -35,6 +35,6 @@ else system_message(elgg_echo('user:language:fail')); - forward($_SERVER['HTTP_REFERER']); - exit; + //forward($_SERVER['HTTP_REFERER']); + //exit; ?>
\ No newline at end of file diff --git a/actions/user/name.php b/actions/user/name.php index bbeed85ec..b93c804b3 100644 --- a/actions/user/name.php +++ b/actions/user/name.php @@ -35,6 +35,6 @@ else system_message(elgg_echo('user:name:fail')); - forward($_SERVER['HTTP_REFERER']); - exit; + //forward($_SERVER['HTTP_REFERER']); + //exit; ?>
\ No newline at end of file diff --git a/actions/user/password.php b/actions/user/password.php index 4c7ceb65c..ec3252644 100644 --- a/actions/user/password.php +++ b/actions/user/password.php @@ -43,9 +43,7 @@ else system_message(elgg_echo('user:password:fail:tooshort')); } - else - system_message(elgg_echo('user:password:fail')); - forward($_SERVER['HTTP_REFERER']); - exit; + //forward($_SERVER['HTTP_REFERER']); + //exit; ?>
\ No newline at end of file diff --git a/actions/usersettings/save.php b/actions/usersettings/save.php new file mode 100644 index 000000000..6322369bc --- /dev/null +++ b/actions/usersettings/save.php @@ -0,0 +1,21 @@ +<?php
+ /**
+ * Aggregate action for saving settings
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ global $CONFIG;
+
+ gatekeeper();
+
+ trigger_plugin_hook('usersettings:save','user');
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
diff --git a/engine/lib/notification.php b/engine/lib/notification.php index aa2ecbfdd..c5b3cacf1 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -250,7 +250,17 @@ // Add settings view to user settings & register action extend_elgg_settings_page('notifications/settings/usersettings', 'usersettings/user'); - register_action("notifications/settings/usersettings/save"); +
+ register_plugin_hook('usersettings:save','user','notification_user_settings_save');
+
+ //register_action("notifications/settings/usersettings/save"); + }
+
+ function notification_user_settings_save() {
+
+ global $CONFIG;
+ @include($CONFIG->path . "actions/notifications/settings/usersettings/save.php");
+
} // Register a startup event diff --git a/engine/lib/users.php b/engine/lib/users.php index 644c5000b..d8fc53f79 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -914,22 +914,37 @@ register_action("friends/add");
register_action("friends/remove");
register_action("email/confirm"); - +
+ register_action("usersettings/save");
+ // User name change extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1); - register_action("user/name"); + //register_action("user/name"); // User password change extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1); - register_action("user/password"); + //register_action("user/password"); // Add email settings extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1); - register_action("email/save"); + //register_action("email/save"); // Add language settings extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1); - register_action("user/language");
+ //register_action("user/language");
+
+ register_plugin_hook('usersettings:save','user','users_settings_save');
+
+ }
+
+ function users_settings_save() {
+
+ global $CONFIG;
+ @include($CONFIG->path . "actions/user/name.php");
+ @include($CONFIG->path . "actions/user/password.php");
+ @include($CONFIG->path . "actions/email/save.php");
+ @include($CONFIG->path . "actions/user/language.php");
+
}
//register actions *************************************************************
diff --git a/settings/user/index.php b/settings/user/index.php index 274e86e9b..99701a83d 100644 --- a/settings/user/index.php +++ b/settings/user/index.php @@ -18,5 +18,9 @@ // Display main admin menu - page_draw(elgg_echo("usersettings:user"),elgg_view_layout("one_column",elgg_view("usersettings/user"))); + page_draw(
+ elgg_echo("usersettings:user"),
+ elgg_view_layout("one_column",
+ elgg_view("usersettings/form"))
+ ); ?>
\ No newline at end of file diff --git a/views/default/notifications/settings/usersettings.php b/views/default/notifications/settings/usersettings.php index 71c12fdc5..af7c6cf54 100644 --- a/views/default/notifications/settings/usersettings.php +++ b/views/default/notifications/settings/usersettings.php @@ -13,7 +13,6 @@ global $NOTIFICATION_HANDLERS; $notification_settings = get_user_notification_settings(); ?> -<form action="<?php echo $vars['url']; ?>action/notifications/settings/usersettings/save" method="post"> <h2><?php echo elgg_echo('notifications:usersettings'); ?></h2> <p><?php echo elgg_echo('notifications:methods'); ?> @@ -35,12 +34,4 @@ <?php } ?> - </table> - <p> - <input type="submit" value="<?php - - echo elgg_echo('save'); - - ?>" /> - </p> -</form>
\ No newline at end of file + </table>
\ No newline at end of file diff --git a/views/default/user/settings/email.php b/views/default/user/settings/email.php index fdd509cba..24fcc7a0d 100644 --- a/views/default/user/settings/email.php +++ b/views/default/user/settings/email.php @@ -15,18 +15,8 @@ if ($user) { ?> <h2><?php echo elgg_echo('email:settings'); ?></h2> - <form action="<?php echo $vars['url']; ?>action/email/save" method="post"> <p> <?php echo elgg_echo('email:address:label'); ?> : <input type="text" name="email" value="<?php echo $user->email; ?>" /> </p> - - <p> - <input type="submit" value="<?php - - echo elgg_echo('save'); - - ?>" /> - </p> - </form> <?php } ?>
\ No newline at end of file diff --git a/views/default/user/settings/language.php b/views/default/user/settings/language.php index 476f21924..dcc20e8ef 100644 --- a/views/default/user/settings/language.php +++ b/views/default/user/settings/language.php @@ -16,7 +16,6 @@ if ($user) { ?> <h2><?php echo elgg_echo('user:set:language'); ?></h2> - <form action="<?php echo $vars['url']; ?>action/user/language" method="post"> <p> <?php echo elgg_echo('user:language:label'); ?> : <input type="text" name="language" value="<?php if ($user->language) @@ -25,14 +24,5 @@ echo $CONFIG->language; ?>" /> </p> - - <p> - <input type="submit" value="<?php - - echo elgg_echo('save'); - - ?>" /> - </p> - </form> <?php } ?>
\ No newline at end of file diff --git a/views/default/user/settings/name.php b/views/default/user/settings/name.php index 3525dc958..da0ded99a 100644 --- a/views/default/user/settings/name.php +++ b/views/default/user/settings/name.php @@ -15,18 +15,8 @@ if ($user) { ?> <h2><?php echo elgg_echo('user:set:name'); ?></h2> - <form action="<?php echo $vars['url']; ?>action/user/name" method="post"> <p> <?php echo elgg_echo('user:name:label'); ?> : <input type="text" name="name" value="<?php echo $user->name; ?>" /> </p> - - <p> - <input type="submit" value="<?php - - echo elgg_echo('save'); - - ?>" /> - </p> - </form> <?php } ?>
\ No newline at end of file diff --git a/views/default/user/settings/password.php b/views/default/user/settings/password.php index 27b48e63d..b40a131e6 100644 --- a/views/default/user/settings/password.php +++ b/views/default/user/settings/password.php @@ -15,19 +15,9 @@ if ($user) { ?> <h2><?php echo elgg_echo('user:set:password'); ?></h2> - <form action="<?php echo $vars['url']; ?>action/user/password" method="post"> <p> <?php echo elgg_echo('user:password:label'); ?> : <input type="password" name="password" value="" /> <?php echo elgg_echo('user:password2:label'); ?> : <input type="password" name="password2" value="" /> </p> - - <p> - <input type="submit" value="<?php - - echo elgg_echo('save'); - - ?>" /> - </p> - </form> <?php } ?>
\ No newline at end of file diff --git a/views/default/usersettings/form.php b/views/default/usersettings/form.php new file mode 100644 index 000000000..c6f2f4968 --- /dev/null +++ b/views/default/usersettings/form.php @@ -0,0 +1,12 @@ +<form action="<?php echo $vars['url']; ?>action/usersettings/save" method="post" >
+<?php
+
+ echo elgg_view("usersettings/user");
+
+?>
+
+ <p>
+ <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
+ </p>
+
+</form>
\ No newline at end of file |