]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Adding an option to restrict new user registration in advanced site settings.
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 7 May 2010 21:49:19 +0000 (21:49 +0000)
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 7 May 2010 21:49:19 +0000 (21:49 +0000)
This is the first step in fully merging "Walled Garden" plugin into core Elgg engine.

git-svn-id: http://code.elgg.org/elgg/trunk@5981 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/admin/site/update_advanced.php
actions/register.php
actions/systemsettings/install.php
engine/lib/upgrades/2010050701.php [new file with mode: 0644]
version.php
views/default/account/forms/login.php
views/default/account/forms/login_dropdown.php
views/default/admin/site/advanced.php

index c9b78c261df9e62af12628eeb73605aa23a6dde5..7e6bd0cc6576c6061e0a54f34331d6dad3a0f66f 100644 (file)
@@ -49,6 +49,13 @@ if (datalist_get('default_site')) {
        } else {
                unset_config('debug', $site->getGUID());
        }
+       
+       // allow new user registration?
+       if (get_input('allow_registration', FALSE)) {
+               set_config('allow_registration', TRUE, $site->getGUID());
+       } else {
+               set_config('allow_registration', FALSE, $site->getGUID());
+       }
 
        $https_login = get_input('https_login');
        if ($https_login) {
index 081a4e4542b2bcb1bd74f479684b6475dbc01bd4..556bad4cd0c71e763f99a55355e98bc989bc45a0 100644 (file)
@@ -24,7 +24,7 @@ if (is_array($admin)) {
        $admin = $admin[0];
 }
 
-if (!$CONFIG->disable_registration) {
+if ($CONFIG->allow_registration) {
 // For now, just try and register the user
        try {
                $guid = register_user($username, $password, $name, $email, false, $friend_guid, $invitecode);
index 589e3a06ca403b27d4b45f114af483bc43506f19..3516a2ff2be7e1cfed3cd5b84ed53f14ae7703dc 100644 (file)
@@ -68,6 +68,7 @@ if (get_input('settings') == 'go') {
                set_config('view', get_input('view'), $site->getGUID());
                set_config('language', get_input('language'), $site->getGUID());
                set_config('default_access', get_input('default_access'), $site->getGUID());
+               set_config('allow_registration', TRUE, $site->getGUID());
 
                $debug = get_input('debug');
                if ($debug) {
diff --git a/engine/lib/upgrades/2010050701.php b/engine/lib/upgrades/2010050701.php
new file mode 100644 (file)
index 0000000..33e4b5b
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Removes the Walled Garden plugin in favor of new system settings
+ */
+
+$access = elgg_set_ignore_access(TRUE);
+
+if (is_plugin_enabled('walledgarden')) {
+       disable_plugin('walledgarden');
+       set_config('allow_registration', FALSE);
+} else {
+       set_config('allow_registration', TRUE);
+}
+
+elgg_set_ignore_access($access);
index 20d459ee5790402d5002f3e93d1cc28ffda6cba4..62fb107ef7a9663f4bd5191809cc152632370b41 100644 (file)
@@ -12,7 +12,7 @@
 
 // YYYYMMDD = Elgg Date
 // XX = Interim incrementer
-$version = 2010040201;
+$version = 2010050701;
 
 // Human-friendly version name
 $release = '1.8-svn';
index ec6e61cfcfda00cee94ab1a13e5b415f12fd59b4..baea51770c6a43c1f65164e9ce7174beb47c4528 100644 (file)
@@ -8,8 +8,6 @@
  * @link http://elgg.org/
  */
 
-global $CONFIG;
-
 $form_body = "<label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login_textarea')) . "</label>";
 $form_body .= "<br />";
 $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login_textarea')) . "</label><br />";
@@ -19,7 +17,7 @@ $form_body .= elgg_view('input/hidden', array('internalname' => 'returntoreferer
 $form_body .= elgg_view('input/submit', array('value' => elgg_echo('login')));
 $form_body .= "<div class='persistent_login'><label><input type='checkbox' name='persistent' value='true' />".elgg_echo('user:persistent')."</label></div>";
 $form_body .= "<p class='loginbox'>";
-$form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "<a href=\"{$vars['url']}pg/register/\">" . elgg_echo('register') . "</a> | " : "";
+$form_body .= $CONFIG->allow_registration ? "<a href=\"{$vars['url']}pg/register/\">" . elgg_echo('register') . '</a> | ' : '';
 $form_body .= "<a href=\"{$vars['url']}account/forgotten_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
 
 $login_url = $vars['url'];
index 352e32e60f036fd56ead492275f1afcc4b029b8d..16f7ee78b71a67609b50958bacfd068733e40df8 100644 (file)
@@ -4,10 +4,7 @@
 *
 */
 
-if (!isloggedin()){
-
-       global $CONFIG;
-
+if (!isloggedin()) {
        $form_body  = "<p class='loginbox'><label>" . elgg_echo('username') . "</label>" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login_textarea name'));
        $form_body .= "<label>" . elgg_echo('password') . "</label>" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login_textarea'));
        $form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . " <span class='remember'><label><input type=\"checkbox\" name=\"persistent\" value=\"true\" />".elgg_echo('user:persistent')."</label></span></p>";
@@ -15,7 +12,7 @@ if (!isloggedin()){
        $form_body .= elgg_view('login/extend');
 
        $form_body .= "<p class='loginbox'>";
-       $form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "<a href=\"{$vars['url']}account/register.php\">" . elgg_echo('register') . "</a> | " : "";
+       $form_body .= $CONFIG->allow_registration ? "<a href=\"{$vars['url']}account/register.php\">" . elgg_echo('register') . '</a> | ' : '';
        $form_body .= "<a href=\"{$vars['url']}account/forgotten_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
        $form_body .= "<input type='hidden' name='returntoreferer' value='true' />";
 
index da7b98a1a9da86a146f8da8e1dbd88aac2c68136..e8c6e9b9ac44790284bdc36cf8a3a97dd5212de9 100644 (file)
@@ -33,6 +33,14 @@ $form_body .= "<p>" . elgg_echo('installation:debug');
 $form_body .= elgg_view('input/pulldown', array('options_values' => $debug_options, 'internalname' => 'debug', 'value' => $vars['config']->debug));
 $form_body .= '</p>';
 
+$options = array(
+       'options' => array(elgg_echo('installation:registration:label')),
+       'internalname' => 'allow_registration',
+       'value' => $vars['config']->allow_registration ? elgg_echo('installation:registration:label') : '',
+);
+$form_body .= '<p>' . elgg_echo('installation:registration:description');
+$form_body .= '<br />' .elgg_view('input/checkboxes', $options) . '</p>';
+
 $form_body .= "<p>" . elgg_echo('installation:httpslogin') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "</p>";
 
 $form_body .= "<p>" . elgg_echo('installation:disableapi') . "<br />";