WordPress.org

WordPress MU

Changeset 1321


Ignore:
Timestamp:
06/04/08 17:09:47 (6 years ago)
Author:
donncha
Message:

tableless signup form, props momo360modena, fixes #482

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-signup.php

    r1316 r1321  
    2525 
    2626function wpmu_signup_stylesheet() { 
    27 ?> 
    28 <style type="text/css"> 
    29 form { margin-top: 2em; } 
    30 #submit, #blog_title, #user_email { 
    31     width: 90%; 
    32     font-size: 24px; 
    33 } 
    34 .error { 
    35     background-color: #f66; 
    36 } 
    37 </style> 
    38 <?php 
     27    ?> 
     28    <style type="text/css">  
     29        .mu_register { width: 90%; margin:0 auto; } 
     30        .mu_register form { margin-top: 2em; } 
     31        .mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; } 
     32        .mu_register #submit, 
     33            .mu_register #blog_title, 
     34            .mu_register #user_email,  
     35            .mu_register #blog_id, 
     36            .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }   
     37        .mu_register .prefix_address, 
     38            .mu_register .suffix_address {font-size: 18px;display:inline; }          
     39        .mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; } 
     40        .mu_register label.checkbox { display:inline; } 
     41        .mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; } 
     42    </style> 
     43    <?php 
    3944} 
    4045 
     
    4348?> 
    4449<div id="content" class="widecolumn"> 
     50<div class="mu_register"> 
    4551<?php 
    4652function show_blog_form($blog_id = '', $blog_title = '', $errors = '') { 
    4753    global $current_site; 
    48     $locale = get_locale(); 
    49  
    50     // Blog name/Username 
    51     if ( $errors->get_error_message('blog_id') ) 
    52         print '<tr class="error">'; 
     54    // Blog name 
     55    if( constant( "VHOST" ) == 'no' ) 
     56        echo '<label for="blog_id">' . __('Blog Name:') . '</label>'; 
    5357    else 
    54         print '<tr>'; 
    55  
    56     if( constant( "VHOST" ) == 'no' ) 
    57         echo '<th valign="top">' . __('Blog Name:') . '</th><td>'; 
    58     else 
    59         echo '<th valign="top">' . __('Blog Domain:') . '</th><td>'; 
    60  
    61     if ( $errmsg = $errors->get_error_message('blog_id') ) { 
    62         ?><p><strong><?php echo $errmsg ?></strong></p><?php 
    63     } 
     58        echo '<label for="blog_id">' . __('Blog Domain:') . '</label>'; 
     59 
     60    if ( $errmsg = $errors->get_error_message('blog_id') ) { ?> 
     61        <p class="error"><?php echo $errmsg ?></p> 
     62    <?php } 
     63 
    6464    if( constant( "VHOST" ) == 'no' ) { 
    65         print '<span style="font-size: 20px">' . $current_site->domain . $current_site->path . '</span><input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" style="width:40%; text-align: left; font-size: 20px;" /><br />'; 
     65        echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" /><br />'; 
    6666    } else { 
    67         print '<input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" style="width:40%; text-align: right; font-size: 20px;" /><span style="font-size: 20px">.' . $current_site->domain . $current_site->path . '</span><br />'; 
     67        echo '<input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />'; 
    6868    } 
    6969    if ( !is_user_logged_in() ) { 
     
    7474            print __( 'domain.' ) . $current_site->domain . $current_site->path; 
    7575        } 
    76         print '.</strong>' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' ) . '</td> </tr>'; 
     76        echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' ) . '</p>'; 
    7777    } 
    7878 
    7979    // Blog Title 
    80     if ( $errors->get_error_message('blog_title')) { 
    81         print '<tr class="error">'; 
    82     } else { 
    83         print '<tr>'; 
    84     } 
    85 ?><th valign="top" width="120"><?php _e('Blog Title:') ?></th><td><?php 
    86  
    87     if ( $errmsg = $errors->get_error_message('blog_title') ) { 
    88 ?><p><strong><?php echo $errmsg ?></strong></p><?php 
    89     } 
    90     print '<input name="blog_title" type="text" id="blog_title" value="'.wp_specialchars($blog_title, 1).'" /></td> 
    91         </tr>'; 
    92 ?> 
    93 <tr> 
    94 <th scope="row"  valign="top"><?php _e('Privacy:') ?></th> 
    95 <td><?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.'); ?>  
    96 <label><input type="radio" name="blog_public" value="1" <?php if( !isset( $_POST[ 'blog_public' ] ) || $_POST[ 'blog_public' ] == '1' ) { ?>checked="checked"<?php } ?> /> <strong><?php _e( 'Yes' ); ?></strong> </label> <label><input type="radio" name="blog_public" value="0" <?php if( isset( $_POST[ 'blog_public' ] ) && $_POST[ 'blog_public' ] == '0' ) { ?>checked="checked"<?php } ?> /><strong><?php _e( 'No' ); ?></strong> </label> <br /> 
    97 </tr> 
    98 <?php 
    99 do_action('signup_blogform', $errors); 
     80    ?> 
     81    <label for="blog_title"><?php _e('Blog Title:') ?></label>   
     82    <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> 
     83        <p class="error"><?php echo $errmsg ?></p> 
     84    <?php } 
     85    echo '<input name="blog_title" type="text" id="blog_title" value="'.wp_specialchars($blog_title, 1).'" /></p>'; 
     86    ?> 
     87 
     88    <p> 
     89        <label for="blog_public_on"><?php _e('Privacy:') ?></label> 
     90        <?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.'); ?>  
     91        <div style="clear:both;"></div> 
     92        <label class="checkbox" for="blog_public_on"> 
     93            <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> /> 
     94            <strong><?php _e( 'Yes' ); ?></strong> 
     95        </label> 
     96        <label class="checkbox" for="blog_public_off"> 
     97            <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> /> 
     98            <strong><?php _e( 'No' ); ?></strong> 
     99        </label> 
     100    </p> 
     101     
     102    <?php 
     103    do_action('signup_blogform', $errors); 
    100104} 
    101105 
    102106function validate_blog_form() { 
     107    $user = ''; 
    103108    if ( is_user_logged_in() ) 
    104109        $user = wp_get_current_user(); 
    105     else 
    106         $user = ''; 
    107  
    108     $result = wpmu_validate_blog_signup($_POST['blog_id'], $_POST['blog_title'], $user); 
    109  
    110     return $result; 
     110 
     111    return wpmu_validate_blog_signup($_POST['blog_id'], $_POST['blog_title'], $user); 
    111112} 
    112113 
    113114function show_user_form($user_name = '', $user_email = '', $errors = '') { 
    114     // Blog name/Username 
    115     if ( $errors->get_error_message('user_name') ) { 
    116         print '<tr class="error">'; 
    117     } else { 
    118         print '<tr>'; 
    119     } 
    120  
    121     echo '<th valign="top">' . __('Username:') . '</th><td>'; 
    122  
     115    // User name 
     116    echo '<label for="user_name">' . __('Username:') . '</label>'; 
    123117    if ( $errmsg = $errors->get_error_message('user_name') ) { 
    124         ?><p><strong><?php echo $errmsg ?></strong></p><?php 
    125     } 
    126  
    127     print '<input name="user_name" type="text" id="user_name" value="'.$user_name.'" maxlength="50" style="width:50%; font-size: 30px;" /><br />'; 
    128     _e('(Must be at least 4 characters, letters and numbers only.)'); echo '</td> </tr>'; 
    129  
    130     // User Email 
    131     if ( $errors->get_error_message('user_email') ) { 
    132         print '<tr class="error">'; 
    133     } else { 
    134         print '<tr>'; 
    135     } 
    136 ?><th valign="top"><?php _e('Email&nbsp;Address:') ?></th><td valign="top"><?php 
    137  
    138     if ( $errmsg = $errors->get_error_message('user_email') ) { 
    139 ?><p><strong><?php echo $errmsg ?></strong></p><?php 
    140     } 
    141     ?> 
    142     <input name="user_email" type="text" id="user_email" value="<?php  echo wp_specialchars($user_email, 1) ?>" maxlength="200" /><br /><?php _e('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') ?></td> 
    143     </tr> 
    144     <?php 
    145     if ( $errmsg = $errors->get_error_message('generic') ) 
    146         print '<tr class="error"> <th colspan="2">'.$errmsg.'</th> </tr>'; 
     118        echo '<p class="error">'.$errmsg.'</p>'; 
     119    } 
     120    echo '<input name="user_name" type="text" id="user_name" value="'.$user_name.'" maxlength="50" /><br />'; 
     121    _e('(Must be at least 4 characters, letters and numbers only.)'); 
     122    ?> 
     123 
     124    <label for="user_email"><?php _e('Email&nbsp;Address:') ?></label> 
     125    <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> 
     126        <p class="error"><?php echo $errmsg ?></p> 
     127    <?php } ?>       
     128    <input name="user_email" type="text" id="user_email" value="<?php  echo wp_specialchars($user_email, 1) ?>" maxlength="200" /><br /><?php _e('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') ?> 
     129    <?php 
     130    if ( $errmsg = $errors->get_error_message('generic') ) { 
     131        echo '<p class="error">'.$errmsg.'</p>'; 
     132    } 
    147133    do_action( 'signup_extra_fields', $errors ); 
    148134} 
    149135 
    150136function validate_user_form() { 
    151     $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); 
    152  
    153     return $result; 
     137    return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); 
    154138} 
    155139 
    156140function signup_another_blog($blog_id = '', $blog_title = '', $errors = '') { 
    157     global $current_user, $wpdb, $domain, $current_site; 
    158  
    159     if ( ! is_wp_error($errors) ) 
     141    global $current_user, $current_site; 
     142     
     143    if ( ! is_wp_error($errors) ) { 
    160144        $errors = new WP_Error(); 
     145    } 
    161146 
    162147    // allow definition of default variables 
     
    171156        echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>"; 
    172157    } 
    173  
    174 ?> 
    175 <p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p> 
    176 <?php 
    177     $blogs = get_blogs_of_user($current_user->ID); 
    178  
    179     if ( ! empty($blogs) ) { 
    180         ?><p><?php _e('Here are the blogs you already have:') ?></p><ul><?php 
    181         foreach ( $blogs as $blog ) 
    182             echo "<li><a href='http://" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>"; 
    183         ?></ul><?php 
    184     } 
    185 ?> 
    186 <p><?php _e("If you&#8217;re not going to use a great blog domain, leave it for a new user. Now have at it!") ?></p> 
    187 <form name="setupform" id="setupform" method="post" action="wp-signup.php"> 
    188 <input type="hidden" name="stage" value="gimmeanotherblog" /> 
    189 <?php do_action( "signup_hidden_fields" ); ?> 
    190 <table border="0" width="100%" cellpadding="9"> 
    191 <?php 
    192     show_blog_form($blog_id, $blog_title, $errors); 
    193 ?> 
    194 <tr> 
    195 <th scope="row"  valign="top">&nbsp;</th> 
    196 <td><input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Create Blog &raquo;') ?>" /></td> 
    197 </tr> 
    198 </table> 
    199 </form> 
    200 <?php 
     158    ?> 
     159    <p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p> 
     160     
     161    <?php 
     162    $blogs = get_blogs_of_user($current_user->ID);   
     163    if ( !empty($blogs) ) { ?> 
     164        <p> 
     165            <?php _e('Blogs you are already a member of:') ?> 
     166            <ul> 
     167                <?php foreach ( $blogs as $blog ) { 
     168                    echo "<li><a href='http://" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>"; 
     169                } ?> 
     170            </ul> 
     171        </p> 
     172    <?php } ?> 
     173     
     174    <p><?php _e("If you&#8217;re not going to use a great blog domain, leave it for a new user. Now have at it!") ?></p> 
     175    <form id="setupform" method="post" action="wp-signup.php"> 
     176        <input type="hidden" name="stage" value="gimmeanotherblog" /> 
     177        <?php do_action( "signup_hidden_fields" ); ?> 
     178        <?php show_blog_form($blog_id, $blog_title, $errors); ?> 
     179        <p> 
     180            <input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Create Blog &raquo;') ?>" /></p> 
     181    </form> 
     182    <?php 
    201183} 
    202184 
     
    212194    if ( $errors->get_error_code() ) { 
    213195        signup_another_blog($blog_id, $blog_title, $errors); 
    214         return; 
     196        return false; 
    215197    } 
    216198 
     
    220202    wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid ); 
    221203    confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); 
    222 } 
    223  
    224 function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta) { 
    225 ?> 
    226 <h2><?php printf(__('The blog, %s, is yours.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
    227 <p><?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new blog.  <a href="%3$s">Login</a> as "%4$s" using your existing password.'), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name) ?></p> 
    228 <?php 
     204    return true; 
     205} 
     206 
     207function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') { 
     208    ?> 
     209    <h2><?php printf(__('The blog %s is yours.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
     210    <p> 
     211        <?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new blog.  <a href="%3$s">Login</a> as "%4$s" using your existing password.'), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name) ?> 
     212    </p> 
     213    <?php 
    229214    do_action('signup_finished'); 
    230215} 
     
    233218    global $current_site, $active_signup; 
    234219 
    235     if ( ! is_wp_error($errors) ) 
     220    if ( !is_wp_error($errors) ) 
    236221        $errors = new WP_Error(); 
    237222    if( isset( $_POST[ 'signup_for' ] ) ) { 
     
    246231    $user_email = $filtered_results['user_email']; 
    247232    $errors = $filtered_results['errors']; 
    248 ?> 
    249 <h2><?php printf( __('Get your own %s account in seconds'), $current_site->site_name ) ?></h2> 
    250 <form name="setupform" id="setupform" method="post" action="wp-signup.php"> 
    251 <input type="hidden" name="stage" value="validate-user-signup" /> 
    252 <?php do_action( "signup_hidden_fields" ); ?> 
    253 <table border="0" width="100%" cellpadding="9" cellspacing="4"> 
    254 <?php show_user_form($user_name, $user_email, $errors); ?> 
    255 <tr> 
    256 <th scope="row"  valign="top">&nbsp;</th> 
    257 <td> 
    258 <p> 
    259 <?php if( $active_signup == 'blog' ) { ?> 
    260 <input id="signupblog" type="hidden" name="signup_for" value="blog" /> 
    261 <?php } elseif( $active_signup == 'user' ) { ?> 
    262 <input id="signupblog" type="hidden" name="signup_for" value="user" /> 
    263 <?php } else { ?> 
    264 <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup[ 'blog' ] ?> /> 
    265 <label for="signupblog"><?php _e('Gimme a blog!') ?></label> 
    266 <br /> 
    267 <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup[ 'user' ] ?> /> 
    268 <label for="signupuser"><?php _e('Just a username, please.') ?></label> 
    269 <?php } ?> 
    270 </p> 
    271 </td> 
    272 </tr> 
    273 <tr> 
    274 <th scope="row"  valign="top">&nbsp;</th> 
    275 <td><input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Next &raquo;') ?>" /></td> 
    276 </tr> 
    277 </table> 
    278 </form> 
    279 <?php 
    280  
     233 
     234    ?> 
     235     
     236    <h2><?php printf( __('Get your own %s account in seconds'), $current_site->site_name ) ?></h2> 
     237    <form id="setupform" method="post" action="wp-signup.php"> 
     238        <input type="hidden" name="stage" value="validate-user-signup" /> 
     239        <?php do_action( "signup_hidden_fields" ); ?> 
     240        <?php show_user_form($user_name, $user_email, $errors); ?> 
     241         
     242        <p> 
     243        <?php if( $active_signup == 'blog' ) { ?> 
     244            <input id="signupblog" type="hidden" name="signup_for" value="blog" /> 
     245        <?php } elseif( $active_signup == 'user' ) { ?> 
     246            <input id="signupblog" type="hidden" name="signup_for" value="user" /> 
     247        <?php } else { ?> 
     248            <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> /> 
     249            <label class="checkbox" for="signupblog"><?php _e('Gimme a blog!') ?></label>    
     250            <br />           
     251            <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup['user'] ?> />          
     252            <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label> 
     253        <?php } ?> 
     254        </p> 
     255         
     256        <input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Next &raquo;') ?>" /> 
     257    </form> 
     258    <?php 
    281259} 
    282260 
     
    287265    if ( $errors->get_error_code() ) { 
    288266        signup_user($user_name, $user_email, $errors); 
    289         return; 
     267        return false; 
    290268    } 
    291269 
    292270    if ( 'blog' == $_POST['signup_for'] ) { 
    293271        signup_blog($user_name, $user_email); 
    294         return; 
     272        return false; 
    295273    } 
    296274 
     
    298276 
    299277    confirm_user_signup($user_name, $user_email); 
     278    return true; 
    300279} 
    301280 
    302281function confirm_user_signup($user_name, $user_email) { 
    303 ?> 
    304 <h2><?php printf(__('%s is your new username'), $user_name) ?></h2> 
    305 <p><?php _e('But, before you can start using your new username, <strong>you must activate it</strong>.') ?></p> 
    306 <p><?php printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.  '),  $user_email) ?></p> 
    307 <p><?php _e('If you do not activate your username within two days, you will have to sign up again.'); ?></p> 
    308 <?php 
     282    ?> 
     283    <h2><?php printf(__('%s is your new username'), $user_name) ?></h2> 
     284    <p><?php _e('But, before you can start using your new username, <strong>you must activate it</strong>.') ?></p> 
     285    <p><?php printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.'),  $user_email) ?></p> 
     286    <p><?php _e('If you do not activate your username within two days, you will have to sign up again.'); ?></p> 
     287    <?php 
    309288    do_action('signup_finished'); 
    310289} 
    311290 
    312291function signup_blog($user_name = '', $user_email = '', $blog_id = '', $blog_title = '', $errors = '') { 
    313     if ( ! is_wp_error($errors) ) 
     292    if ( !is_wp_error($errors) ) 
    314293        $errors = new WP_Error(); 
    315294 
     
    324303    if ( empty($blog_id) ) 
    325304        $blog_id = $user_name; 
    326 ?> 
    327 <form name="setupform" id="setupform" method="post" action="wp-signup.php"> 
    328 <input type="hidden" name="stage" value="validate-blog-signup" /> 
    329 <input type="hidden" name="user_name" value="<?php echo $user_name ?>" /> 
    330 <input type="hidden" name="user_email" value="<?php echo $user_email ?>" /> 
    331 <?php do_action( "signup_hidden_fields" ); ?> 
    332 <table border="0" width="100%" cellpadding="9"> 
    333 <?php show_blog_form($blog_id, $blog_title, $errors); ?> 
    334 <tr> 
    335 <th scope="row"  valign="top">&nbsp;</th> 
    336 <td><input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Signup &raquo;') ?>" /></td> 
    337 </tr> 
    338 </table> 
    339 </form> 
    340 <?php 
     305    ?> 
     306    <form id="setupform" method="post" action="wp-signup.php"> 
     307        <input type="hidden" name="stage" value="validate-blog-signup" /> 
     308        <input type="hidden" name="user_name" value="<?php echo $user_name ?>" /> 
     309        <input type="hidden" name="user_email" value="<?php echo $user_email ?>" /> 
     310        <?php do_action( "signup_hidden_fields" ); ?> 
     311        <?php show_blog_form($blog_id, $blog_title, $errors); ?> 
     312        <p> 
     313            <input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Signup &raquo;') ?>" /></p> 
     314    </form> 
     315    <?php 
    341316} 
    342317 
     
    348323    if ( $errors->get_error_code() ) { 
    349324        signup_user($user_name, $user_email, $errors); 
    350         return; 
     325        return false; 
    351326    } 
    352327 
     
    356331    if ( $errors->get_error_code() ) { 
    357332        signup_blog($user_name, $user_email, $blog_id, $blog_title, $errors); 
    358         return; 
     333        return false; 
    359334    } 
    360335 
     
    364339 
    365340    wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); 
    366  
    367341    confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); 
    368 } 
    369  
    370 function confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta) { 
    371 ?> 
    372 <h2><?php printf(__('Congratulations! Your new blog, %s, is almost ready.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
    373 <p><?php _e('But, before you can start using your blog, <strong>you must activate it</strong>.') ?></p> 
    374 <p><?php printf(__('Check your inbox at <strong>%s</strong> and click the link given. It should arrive within 30 minutes.'),  $user_email) ?></p> 
    375 <p><?php _e('If you do not activate your blog within two days, you will have to sign up again.'); ?></p> 
    376 <h2><?php _e('Still waiting for your email?') ?></h2> 
    377 <p><?php _e("If you haven't received your email yet, there are a number of things you can do:") ?></p> 
    378 <ul> 
    379 <li><p><strong><?php _e('Wait a little longer.  Sometimes delivery of email can be delayed by precesses outside of our control.') ?></strong></p></li> 
    380 <li><p><?php _e('Check the junk email or spam folder of your email client.  Sometime emails wind up there by mistake.') ?></p></li> 
    381 <li><?php printf(__("Have you entered your email correctly?  We think it's %s but if you've entered it incorrectly, you won't receive it."), $user_email) ?></li> 
    382 </ul> 
    383 <?php 
     342    return true; 
     343} 
     344 
     345function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) { 
     346    ?> 
     347    <h2><?php printf(__('Congratulations! Your new blog, %s, is almost ready.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
     348     
     349    <p><?php _e('But, before you can start using your blog, <strong>you must activate it</strong>.') ?></p> 
     350    <p><?php printf(__('Check your inbox at <strong>%s</strong> and click the link given. It should arrive within 30 minutes.'),  $user_email) ?></p> 
     351    <p><?php _e('If you do not activate your blog within two days, you will have to sign up again.'); ?></p> 
     352    <h2><?php _e('Still waiting for your email?') ?></h2> 
     353    <p> 
     354        <?php _e("If you haven't received your email yet, there are a number of things you can do:") ?> 
     355        <ul> 
     356            <li><p><strong><?php _e('Wait a little longer.  Sometimes delivery of email can be delayed by precesses outside of our control.') ?></strong></p></li> 
     357            <li><p><?php _e('Check the junk email or spam folder of your email client.  Sometime emails wind up there by mistake.') ?></p></li> 
     358            <li><?php printf(__("Have you entered your email correctly?  We think it's %s but if you've entered it incorrectly, you won't receive it."), $user_email) ?></li> 
     359        </ul> 
     360    </p> 
     361    <?php 
    384362    do_action('signup_finished'); 
    385363} 
     
    392370$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user" 
    393371 
    394 if( is_site_admin() ) { 
    395     echo "<div style='background: #faf; font-weight: bold; border: 1px solid #333; margin: 2px; padding: 2px'>" . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/wpmu-options.php'>Options page</a>." ), $active_signup ) . "</div>"; 
    396 } 
     372if( is_site_admin() ) 
     373    echo '<div class="mu_alert">' . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/wpmu-options.php'>Options page</a>." ), $active_signup ) . '</div>'; 
    397374 
    398375$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; 
     
    402379    _e( "Registration has been disabled." ); 
    403380} else { 
    404     if( $active_signup == 'blog' && !is_user_logged_in() ) { 
     381    if( $active_signup == 'blog' && !is_user_logged_in() ) 
    405382        wp_die( 'You must be logged in to register a blog.' ); 
    406     } 
     383 
    407384    switch ($_POST['stage']) { 
    408     case 'validate-user-signup' : 
    409         if( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) 
    410             validate_user_signup(); 
    411         else 
    412             _e( "User registration has been disabled." ); 
     385        case 'validate-user-signup' : 
     386            if( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) 
     387                validate_user_signup(); 
     388            else 
     389                _e( "User registration has been disabled." ); 
    413390        break; 
    414     case 'validate-blog-signup': 
    415         if( $active_signup == 'all' || $active_signup == 'blog' ) 
    416             validate_blog_signup(); 
    417         else 
    418             _e( "Blog registration has been disabled." ); 
    419         break; 
    420     case 'gimmeanotherblog': 
    421         validate_another_blog_signup(); 
    422         break; 
    423     default : 
    424         $user_email = $_POST[ 'user_email' ]; 
    425         do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere? 
    426         if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { 
    427             signup_another_blog($newblogname); 
    428         } elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) { 
    429             signup_user( $newblogname, $user_email ); 
    430         } elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) { 
    431             _e( "I'm sorry. We're not accepting new registrations at this time." ); 
    432         } else { 
    433             _e( "You're logged in already. No need to register again!" ); 
    434         } 
    435  
    436         if ($newblogname) { 
    437             if( constant( "VHOST" ) == 'no' ) 
    438                 $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/'; 
     391        case 'validate-blog-signup': 
     392            if( $active_signup == 'all' || $active_signup == 'blog' ) 
     393                validate_blog_signup(); 
    439394            else 
    440                 $newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path; 
    441             printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist but you can create it now!</em></p>"), $newblog ); 
    442         } 
    443         break; 
     395                _e( "Blog registration has been disabled." ); 
     396            break; 
     397        case 'gimmeanotherblog': 
     398            validate_another_blog_signup(); 
     399            break; 
     400        default : 
     401            $user_email = $_POST[ 'user_email' ]; 
     402            do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere? 
     403            if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { 
     404                signup_another_blog($newblogname); 
     405            } elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) { 
     406                signup_user( $newblogname, $user_email ); 
     407            } elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) { 
     408                _e( "I'm sorry. We're not accepting new registrations at this time." ); 
     409            } else { 
     410                _e( "You're logged in already. No need to register again!" ); 
     411            } 
     412            if ($newblogname) { 
     413                if( constant( "VHOST" ) == 'no' ) 
     414                    $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/'; 
     415                else 
     416                    $newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path; 
     417                printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist but you can create it now!</em></p>"), $newblog ); 
     418            } 
     419            break; 
    444420    } 
    445421} 
    446422?> 
    447423</div> 
     424</div> 
    448425 
    449426<?php get_footer(); ?> 
Note: See TracChangeset for help on using the changeset viewer.