From 3221448c7cacf882649f8f991d539c8783f34286 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 29 Jul 2008 15:16:07 +0000 Subject: Registration disabled option (no admin screen yet), closes #184 git-svn-id: https://code.elgg.org/elgg/trunk@1572 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/register.php | 43 ++++++++++++++++++++--------------- languages/en.php | 1 + views/default/account/forms/login.php | 5 ++-- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/actions/register.php b/actions/register.php index 6f4009aaf..b404d844a 100644 --- a/actions/register.php +++ b/actions/register.php @@ -12,6 +12,7 @@ */ require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); + global $CONFIG; // Get variables $username = get_input('username'); @@ -21,25 +22,31 @@ $name = get_input('name'); $admin = get_input('admin'); - + + + if (!$CONFIG->disable_registration) + { // For now, just try and register the user - if ( - ( - (trim($password)!="") && - (strcmp($password, $password2)==0) - ) && - ($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'; + if ( + ( + (trim($password)!="") && + (strcmp($password, $password2)==0) + ) && + ($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 { + register_error(elgg_echo("registerbad")); } - - system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename)); - } else { - register_error(elgg_echo("registerbad")); - } + } + else + register_error(elgg_echo('registerdisabled')); ?> \ No newline at end of file diff --git a/languages/en.php b/languages/en.php index c50d8b155..3d988fb1c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -254,6 +254,7 @@ '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.", + 'registerdisabled' => "Registration has been disabled by the system administrator", 'adduser' => "Add User", 'adduser:ok' => "You have successfully added a new user.", diff --git a/views/default/account/forms/login.php b/views/default/account/forms/login.php index de8eb5ad9..105c4499d 100644 --- a/views/default/account/forms/login.php +++ b/views/default/account/forms/login.php @@ -10,7 +10,8 @@ * @copyright Curverider Ltd 2008 * @link http://elgg.org/ */ - + + global $CONFIG; ?>

@@ -19,6 +20,6 @@

-

+ disable_registration) { ?>

\ No newline at end of file -- cgit v1.2.3