summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-04 15:07:51 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-04 15:07:51 +0000
commit3cc1e1170928773f76aad938f37fd07539206c05 (patch)
tree74fc054011f662fc06d1f1b9d106813f1aca1451
parentf4b9932ffd83269edcd5270b20f4a2aa3f692304 (diff)
downloadwordpress-mu-3cc1e1170928773f76aad938f37fd07539206c05.tar.gz
wordpress-mu-3cc1e1170928773f76aad938f37fd07539206c05.tar.xz
wordpress-mu-3cc1e1170928773f76aad938f37fd07539206c05.zip
Add registration disable/enable radio controls to wpmu-options page
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1062 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--index-install.php1
-rw-r--r--wp-admin/wpmu-edit.php1
-rw-r--r--wp-admin/wpmu-options.php12
-rw-r--r--wp-signup.php7
4 files changed, 20 insertions, 1 deletions
diff --git a/index-install.php b/index-install.php
index 0b37147..0c85b36 100644
--- a/index-install.php
+++ b/index-install.php
@@ -367,6 +367,7 @@ function step3() {
// set up site tables
$wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'admin_email', '".$email."')" );
$wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'admin_user_id', '1')" );
+ $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'registration', 'all')" );
$wpdb->query( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( NULL, '$domain', '$base' )" );
$wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (1, 'Uncategorized', 'uncategorized', NOW())" );
$wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (2, 'Blogroll', 'blogroll', NOW())" );
diff --git a/wp-admin/wpmu-edit.php b/wp-admin/wpmu-edit.php
index 16d43eb..5765f75 100644
--- a/wp-admin/wpmu-edit.php
+++ b/wp-admin/wpmu-edit.php
@@ -24,6 +24,7 @@ switch( $_REQUEST[ 'action' ] ) {
$names[] = trim( $name );
}
update_site_option( "illegal_names", $names );
+ update_site_option( "registration", $wpdb->escape( $_POST[ 'registration' ] ) );
if( $_POST[ 'limited_email_domains' ] != '' ) {
update_site_option( "limited_email_domains", split( ' ', $_POST[ 'limited_email_domains' ] ) );
} else {
diff --git a/wp-admin/wpmu-options.php b/wp-admin/wpmu-options.php
index d845063..b7bbdc8 100644
--- a/wp-admin/wpmu-options.php
+++ b/wp-admin/wpmu-options.php
@@ -35,6 +35,18 @@ if (isset($_GET['updated'])) {
<?php printf( __( 'Registration and support mails will come from this address. Make it generic like "support@%s"' ), $current_site->domain ); ?></td>
</tr>
<tr valign="top">
+ <th scope="row"><?php _e('Allow new blog registrations') ?></th>
+ <?php
+ if( !get_site_option('registration') )
+ update_site_option( 'registration', 'all' );
+ ?>
+ <td><input name="registration1" type="radio" id="registration1" value='none' <?php echo get_site_option('registration') == 'none' ? 'checked' : ''; ?> /> Disabled<br />
+ <input name="registration2" type="radio" id="registration2" value='all' <?php echo get_site_option('registration') == 'all' ? 'checked' : ''; ?> /> Enabled for all. Blogs and user accounts can be created.<br />
+ <input name="registration3" type="radio" id="registration3" value='user' <?php echo get_site_option('registration') == 'user' ? 'checked' : ''; ?> /> Enabled for users only. Only user account can be created.<br />
+ <input name="registration4" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked' : ''; ?> /> Enabled for blogs only. Only logged in users can create new blogs.<br />
+ <?php _e('Disable or enable registration and who or what can be registered. (Default=all)') ?></td>
+ </tr>
+ <tr valign="top">
<th scope="row"><?php _e('Welcome Email:') ?></th>
<td><textarea name="welcome_email" id="welcome_email" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea>
<br />
diff --git a/wp-signup.php b/wp-signup.php
index 9798703..f243c02 100644
--- a/wp-signup.php
+++ b/wp-signup.php
@@ -367,7 +367,10 @@ function confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_emai
}
// Main
-$active_signup = 'all';
+$active_signup = get_site_option( 'registration' );
+if( !$active_signup )
+ $active_signup = 'all';
+
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
@@ -400,6 +403,8 @@ switch ($_POST['stage']) {
signup_another_blog($newblogname);
} elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
signup_user( $newblogname, $user_email );
+ } elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) {
+ _e( "I'm sorry. We're not accepting new registrations at this time." );
} else {
_e( "You're logged in already. No need to register again!" );
}