aboutsummaryrefslogtreecommitdiff
path: root/actions/user/name.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/user/name.php')
-rw-r--r--actions/user/name.php40
1 files changed, 40 insertions, 0 deletions
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