aboutsummaryrefslogtreecommitdiff
path: root/actions/register.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-26 14:03:44 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-26 14:03:44 +0000
commit440196f2a505d91937af3ee17ebb58d3a3702d1a (patch)
treead86ff4eecef0405fc107f8502879dd195541e2e /actions/register.php
parentf750cdf33e7717fdb4fc6caf72361e76385fd6ae (diff)
downloadelgg-440196f2a505d91937af3ee17ebb58d3a3702d1a.tar.gz
elgg-440196f2a505d91937af3ee17ebb58d3a3702d1a.tar.bz2
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
Diffstat (limited to 'actions/register.php')
-rw-r--r--actions/register.php13
1 files changed, 11 insertions, 2 deletions
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"));