aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/email/save.php4
-rw-r--r--actions/user/name.php40
-rw-r--r--engine/lib/notification.php4
-rw-r--r--engine/lib/users.php10
-rw-r--r--languages/en.php7
-rw-r--r--views/default/user/settings/email.php (renamed from views/default/notifications/settings/email.php)0
-rw-r--r--views/default/user/settings/name.php32
7 files changed, 89 insertions, 8 deletions
diff --git a/actions/email/save.php b/actions/email/save.php
index 97065d8b4..08fcc7647 100644
--- a/actions/email/save.php
+++ b/actions/email/save.php
@@ -5,7 +5,7 @@
* @package Elgg
* @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author
+ * @author Marcus Povey
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*/
@@ -22,7 +22,7 @@
if (!$user_id)
$user = $_SESSION['user'];
else
- $user = get_entity($user_guid);
+ $user = get_entity($user_id);
if ($user)
{
diff --git a/actions/user/name.php b/actions/user/name.php
new file mode 100644
index 000000000..8ecfa856d
--- /dev/null
+++ b/actions/user/name.php
@@ -0,0 +1,40 @@
+<?php
+ /**
+ * Action for changing a user's name
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ global $CONFIG;
+
+ gatekeeper();
+
+ $name = get_input('name');
+ $user_id = get_input('guid');
+ $user = "";
+
+ if (!$user_id)
+ $user = $_SESSION['user'];
+ else
+ $user = get_entity($user_id);
+
+ if ($user)
+ {
+ $user->name = $name;
+ if ($user->save())
+ system_message(elgg_echo('user:name:success'));
+ else
+ system_message(elgg_echo('user:name:fail'));
+ }
+ else
+ system_message(elgg_echo('user:name:fail'));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+?> \ No newline at end of file
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 8a2f2c432..aa2ecbfdd 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -248,10 +248,6 @@
// Register a notification handler for the default email method
register_notification_handler("email", "email_notify_handler");
- // Add email settings
- extend_elgg_settings_page('notifications/settings/email', 'usersettings/user');
- register_action("email/save");
-
// Add settings view to user settings & register action
extend_elgg_settings_page('notifications/settings/usersettings', 'usersettings/user');
register_action("notifications/settings/usersettings/save");
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 5b8f04389..c0c43cb2f 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -900,7 +900,15 @@
register_action("register",true);
register_action("friends/add");
register_action("friends/remove");
- register_action("email/confirm");
+ register_action("email/confirm");
+
+ // User name change
+ extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1);
+ register_action("user/name");
+
+ // Add email settings
+ extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1);
+ register_action("email/save");
}
//register actions *************************************************************
diff --git a/languages/en.php b/languages/en.php
index d8814f682..22c2c280f 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -237,7 +237,12 @@
'register' => "Register",
'registerok' => "You have successfully registered for %s.",
- 'registerbad' => "Your registration was unsuccessful. The username may already exist, or your passwords might not match.",
+ 'registerbad' => "Your registration was unsuccessful. The username may already exist, or your passwords might not match.",
+
+ 'user:set:name' => "Account name settings",
+ 'user:name:label' => "Your name",
+ 'user:name:success' => "Successfully changed your name on the system.",
+ 'user:name:fail' => "Could not change your name on the system.",
/**
* Administration
diff --git a/views/default/notifications/settings/email.php b/views/default/user/settings/email.php
index fdd509cba..fdd509cba 100644
--- a/views/default/notifications/settings/email.php
+++ b/views/default/user/settings/email.php
diff --git a/views/default/user/settings/name.php b/views/default/user/settings/name.php
new file mode 100644
index 000000000..3525dc958
--- /dev/null
+++ b/views/default/user/settings/name.php
@@ -0,0 +1,32 @@
+<?php
+ /**
+ * Provide a way of setting your full name.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $user = $_SESSION['user'];
+
+ 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