From 440196f2a505d91937af3ee17ebb58d3a3702d1a Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 26 Jun 2008 14:03:44 +0000 Subject: Refs #96: Administration: Add user (with optional admin flag) http://trac.elgg.org/elgg/ticket/96 git-svn-id: https://code.elgg.org/elgg/trunk@1146 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/register.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'actions/register.php') diff --git a/actions/register.php b/actions/register.php index 88cbf0348..7f49f4924 100644 --- a/actions/register.php +++ b/actions/register.php @@ -19,6 +19,8 @@ $password2 = get_input('password2'); $email = get_input('email'); $name = get_input('name'); + + $admin = get_input('admin'); // For now, just try and register the user if ( @@ -26,8 +28,15 @@ (trim($password)!="") && (strcmp($password, $password2)==0) ) && - (register_user($username, $password, $name, $email)) - ) { + ($guid = register_user($username, $password, $name, $email)) + ) { + if (($guid) && ($admin)) + { + admin_gatekeeper(); // Only admins can make someone an admin + $new_user = get_entity($guid); + $new_user->admin = 'yes'; + } + system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename)); } else { system_message(elgg_echo("registerbad")); -- cgit v1.2.3