diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-26 11:36:01 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-26 11:36:01 +0000 |
commit | 27e6aeae6cc813ef7f0dadd67f3002871bce3356 (patch) | |
tree | b7c857ef8d38d162eb0a3fb23472dfa561a66612 /actions/user | |
parent | be060340842c65bb9f910d3e7805323f007d171b (diff) | |
download | elgg-27e6aeae6cc813ef7f0dadd67f3002871bce3356.tar.gz elgg-27e6aeae6cc813ef7f0dadd67f3002871bce3356.tar.bz2 |
Closes #90: Settings: Change name
http://trac.elgg.org/elgg/ticket/90
git-svn-id: https://code.elgg.org/elgg/trunk@1142 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/user')
-rw-r--r-- | actions/user/name.php | 40 |
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 |