Changeset 958

Show
Ignore:
Timestamp:
04/09/07 11:26:25 (2 years ago)
Author:
donncha
Message:

Added "wpmu_active_signup" filter to return "all", "none", "blog" or "user" to enable all, none or some signup types

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-signup.php

    r946 r958  
    209209 
    210210function signup_user($user_name = '', $user_email = '', $errors = '') { 
    211         global $current_site
     211        global $current_site, $active_signup
    212212 
    213213        if ( ! is_wp_error($errors) ) 
     
    236236<td> 
    237237<p> 
     238<?php if( $active_signup == 'blog' ) { ?> 
     239<input id="signupblog" type="hidden" name="signup_for" value="blog" /> 
     240<?php } elseif( $active_signup == 'user' ) { ?> 
     241<input id="signupblog" type="hidden" name="signup_for" value="user" /> 
     242<?php } else { ?> 
    238243<input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup[ 'blog' ] ?> /> 
    239244<label for="signupblog"><?php _e('Gimme a blog!') ?></label> 
     
    241246<input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup[ 'user' ] ?> /> 
    242247<label for="signupuser"><?php _e('Just a username, please.') ?></label> 
     248<?php } ?> 
    243249</p> 
    244250</td> 
     
    355361        die(); 
    356362} 
     363 
     364$active_signup = 'all'; 
     365$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user" 
     366 
    357367$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; 
    358368if( $_POST['blog_public'] != 1 ) 
    359369        $_POST['blog_public'] = 0; 
    360370 
     371if( $active_signup == "none" ) { 
     372        _e( "Registration has been disabled." ); 
     373} else { 
    361374switch ($_POST['stage']) { 
    362375        case 'validate-user-signup' : 
    363                 validate_user_signup(); 
     376                if( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) 
     377                        validate_user_signup(); 
     378                else 
     379                        _e( "User registration has been disabled." ); 
    364380                break; 
    365381        case 'validate-blog-signup': 
    366                 validate_blog_signup(); 
     382                if( $active_signup == 'all' || $active_signup == 'blog' ) 
     383                        validate_blog_signup(); 
     384                else 
     385                        _e( "Blog registration has been disabled." ); 
    367386                break; 
    368387        case 'gimmeanotherblog': 
     
    386405                break; 
    387406} 
     407} 
    388408?> 
    389409</div>