WordPress.org

Plugin Directory

Changeset 611734


Ignore:
Timestamp:
10/12/12 21:31:40 (19 months ago)
Author:
Ipstenu
Message:

Cleaning up the signup page and read me.

Location:
join-my-multisite/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • join-my-multisite/trunk/admin/defines.php

    r611707 r611734  
    4040    if ($jmm_options['type'] == 2) { add_action( 'widgets_init', 'jmm_load_add_user_widgets' ); } 
    4141 
    42     // Shortcode 
    43     if ( get_option('users_can_register') == 1 && !is_null($jmm_options['perpage']) && $jmm_options['perpage'] != "XXXXXX"  ) { 
    44         include_once( PLUGIN_DIR . '/lib/shortcode.php'); 
    45     } 
     42// Shortcode 
     43include_once( PLUGIN_DIR . '/lib/shortcode.php'); 
    4644 
    4745// The Help Screen 
  • join-my-multisite/trunk/lib/signuppage.php

    r611707 r611734  
    4747<div class="mu_register"> 
    4848<?php 
    49 function show_blog_form($blogname = '', $blog_title = '', $errors = '') { 
    50     global $current_site; 
    51     // Blog name 
    52     if ( !is_subdomain_install() ) 
    53         echo '<label for="blogname">' . __('Site Name:') . '</label>'; 
    54     else 
    55         echo '<label for="blogname">' . __('Site Domain:') . '</label>'; 
    56  
    57     if ( $errmsg = $errors->get_error_message('blogname') ) { ?> 
    58         <p class="error"><?php echo $errmsg ?></p> 
    59     <?php } 
    60  
    61     if ( !is_subdomain_install() ) 
    62         echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; 
    63     else 
    64         echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />'; 
    65  
    66     if ( !is_user_logged_in() ) { 
    67         if ( !is_subdomain_install() ) 
    68             $site = $current_site->domain . $current_site->path . __( 'sitename' ); 
    69         else 
    70             $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; 
    71         echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; 
    72     } 
    73  
    74     // Blog Title 
    75     ?> 
    76     <label for="blog_title"><?php _e('Site Title:') ?></label> 
    77     <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> 
    78         <p class="error"><?php echo $errmsg ?></p> 
    79     <?php } 
    80     echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />'; 
    81     ?> 
    82  
    83     <div id="privacy"> 
    84         <p class="privacy-intro"> 
    85             <label for="blog_public_on"><?php _e('Privacy:') ?></label> 
    86             <?php _e( 'Allow search engines to index this site.' ); ?> 
    87             <br style="clear:both" /> 
    88             <label class="checkbox" for="blog_public_on"> 
    89                 <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 } ?> /> 
    90                 <strong><?php _e( 'Yes' ); ?></strong> 
    91             </label> 
    92             <label class="checkbox" for="blog_public_off"> 
    93                 <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 } ?> /> 
    94                 <strong><?php _e( 'No' ); ?></strong> 
    95             </label> 
    96         </p> 
    97     </div> 
    98  
    99     <?php 
    100     do_action('signup_blogform', $errors); 
    101 } 
    102  
    103 function validate_blog_form() { 
    104     $user = ''; 
    105     if ( is_user_logged_in() ) 
    106         $user = wp_get_current_user(); 
    107  
    108     return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); 
    109 } 
    11049 
    11150function show_user_form($user_name = '', $user_email = '', $errors = '') { 
    11251    // User name 
    113     echo '<label for="user_name">' . __('Username:') . '</label>'; 
     52    echo '<label for="user_name">' . __('Username:', 'helfjmm') . '</label>'; 
    11453    if ( $errmsg = $errors->get_error_message('user_name') ) { 
    11554        echo '<p class="error">'.$errmsg.'</p>'; 
    11655    } 
    11756    echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />'; 
    118     _e( '(Must be at least 4 characters, letters and numbers only.)' ); 
     57    _e( '(Must be at least 4 characters, letters and numbers only.)', 'helfjmm' ); 
    11958    ?> 
    12059 
    121     <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label> 
     60    <label for="user_email"><?php _e( 'Email&nbsp;Address:', 'helfjmm' ) ?></label> 
    12261    <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> 
    12362        <p class="error"><?php echo $errmsg ?></p> 
    12463    <?php } ?> 
    125     <input name="user_email" type="text" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> 
     64    <input name="user_email" type="text" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)', 'helfjmm') ?> 
    12665    <?php 
    12766    if ( $errmsg = $errors->get_error_message('generic') ) { 
     
    13372function validate_user_form() { 
    13473    return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); 
    135 } 
    136  
    137 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { 
    138     global $current_site; 
    139     $current_user = wp_get_current_user(); 
    140  
    141     if ( ! is_wp_error($errors) ) { 
    142         $errors = new WP_Error(); 
    143     } 
    144  
    145     // allow definition of default variables 
    146     $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 
    147     $blogname = $filtered_results['blogname']; 
    148     $blog_title = $filtered_results['blog_title']; 
    149     $errors = $filtered_results['errors']; 
    150  
    151     echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>'; 
    152  
    153     if ( $errors->get_error_code() ) { 
    154         echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; 
    155     } 
    156     ?> 
    157     <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p> 
    158  
    159     <?php 
    160     $blogs = get_blogs_of_user($current_user->ID); 
    161     if ( !empty($blogs) ) { ?> 
    162  
    163             <p><?php _e( 'Sites you are already a member of:' ) ?></p> 
    164             <ul> 
    165                 <?php foreach ( $blogs as $blog ) { 
    166                     $home_url = get_home_url( $blog->userblog_id ); 
    167                     echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>'; 
    168                 } ?> 
    169             </ul> 
    170     <?php } ?> 
    171  
    172     <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p> 
    173     <form id="setupform" method="post" action="<?php echo $goto; ?>"> 
    174         <input type="hidden" name="stage" value="gimmeanotherblog" /> 
    175         <?php do_action( 'signup_hidden_fields' ); ?> 
    176         <?php show_blog_form($blogname, $blog_title, $errors); ?> 
    177         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p> 
    178     </form> 
    179     <?php 
    180 } 
    181  
    182 function validate_another_blog_signup() { 
    183     global $wpdb, $blogname, $blog_title, $errors, $domain, $path; 
    184     $current_user = wp_get_current_user(); 
    185     if ( !is_user_logged_in() ) 
    186         die(); 
    187  
    188     $result = validate_blog_form(); 
    189     extract($result); 
    190  
    191     if ( $errors->get_error_code() ) { 
    192         signup_another_blog($blogname, $blog_title, $errors); 
    193         return false; 
    194     } 
    195  
    196     $public = (int) $_POST['blog_public']; 
    197     $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated 
    198     $meta = apply_filters( 'add_signup_meta', $meta ); 
    199  
    200     wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); 
    201     confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); 
    202     return true; 
    203 } 
    204  
    205 function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') { 
    206     ?> 
    207     <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
    208     <p> 
    209         <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> 
    210     </p> 
    211     <?php 
    212     do_action( 'signup_finished' ); 
    21374} 
    21475 
     
    22687    $user_email = $filtered_results['user_email']; 
    22788    $errors = $filtered_results['errors']; 
     89     
     90    $blog_details = get_blog_details($blog_id); 
    22891 
    22992    ?> 
    23093 
    231     <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2> 
     94    <h2><?php printf( __( 'Get a user account on %s in seconds', 'helfjmm' ), $blog_details->blogname ) ?></h2> 
    23295    <form id="setupform" method="post" action="<?php echo $goto; ?>"> 
    23396        <input type="hidden" name="stage" value="validate-user-signup" /> 
     
    23699 
    237100        <p> 
    238         <?php if ( $active_signup == 'blog' ) { ?> 
    239             <input id="signupblog" type="hidden" name="signup_for" value="blog" /> 
    240         <?php } elseif ( $active_signup == 'user' ) { ?> 
    241101            <input id="signupblog" type="hidden" name="signup_for" value="user" /> 
    242         <?php } else { ?> 
    243             <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> 
    244             <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label> 
    245             <br /> 
    246             <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> /> 
    247             <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label> 
    248         <?php } ?> 
    249102        </p> 
    250103 
    251         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p> 
     104        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Sign Up', 'helfjmm') ?>" /></p> 
    252105    </form> 
    253106    <?php 
     
    277130    ?> 
    278131    <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2> 
    279     <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p> 
    280     <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p> 
    281     <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> 
    282     <?php 
    283     do_action( 'signup_finished' ); 
    284 } 
    285  
    286 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { 
    287     if ( !is_wp_error($errors) ) 
    288         $errors = new WP_Error(); 
    289  
    290     // allow definition of default variables 
    291     $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 
    292     $user_name = $filtered_results['user_name']; 
    293     $user_email = $filtered_results['user_email']; 
    294     $blogname = $filtered_results['blogname']; 
    295     $blog_title = $filtered_results['blog_title']; 
    296     $errors = $filtered_results['errors']; 
    297  
    298     if ( empty($blogname) ) 
    299         $blogname = $user_name; 
    300     ?> 
    301     <form id="setupform" method="post" action="<?php echo $goto; ?>"> 
    302         <input type="hidden" name="stage" value="validate-blog-signup" /> 
    303         <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" /> 
    304         <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" /> 
    305         <?php do_action( 'signup_hidden_fields' ); ?> 
    306         <?php show_blog_form($blogname, $blog_title, $errors); ?> 
    307         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p> 
    308     </form> 
    309     <?php 
    310 } 
    311  
    312 function validate_blog_signup() { 
    313     // Re-validate user info. 
    314     $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); 
    315     extract($result); 
    316  
    317     if ( $errors->get_error_code() ) { 
    318         signup_user($user_name, $user_email, $errors); 
    319         return false; 
    320     } 
    321  
    322     $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); 
    323     extract($result); 
    324  
    325     if ( $errors->get_error_code() ) { 
    326         signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); 
    327         return false; 
    328     } 
    329  
    330     $public = (int) $_POST['blog_public']; 
    331     $meta = array ('lang_id' => 1, 'public' => $public); 
    332     $meta = apply_filters( 'add_signup_meta', $meta ); 
    333  
    334     wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); 
    335     confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); 
    336     return true; 
    337 } 
    338  
    339 function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) { 
    340     ?> 
    341     <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 
    342  
    343     <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p> 
    344     <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email) ?></p> 
    345     <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> 
    346     <h2><?php _e( 'Still waiting for your email?' ); ?></h2> 
    347     <p> 
    348         <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?> 
    349         <ul id="noemail-tips"> 
    350             <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li> 
    351             <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li> 
    352             <li><?php printf( __( 'Have you entered your email correctly?  You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li> 
    353         </ul> 
    354     </p> 
     132    <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.', 'helfjmm' ) ?></p> 
     133    <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.', 'helfjmm' ), $user_email ); ?></p> 
     134    <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.', 'helfjmm' ); ?></p> 
    355135    <?php 
    356136    do_action( 'signup_finished' ); 
     
    371151 
    372152if ( is_super_admin() ) 
    373     echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; 
     153    echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.', 'helfjmm' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; 
    374154 
    375155$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; 
     
    378158if ( $active_signup == 'none' ) { 
    379159    _e( 'Registration has been disabled.' ); 
    380 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) { 
    381     if ( is_ssl() ) 
    382         $proto = 'https://'; 
    383     else 
    384         $proto = 'http://'; 
    385     $login_url = site_url( 'wp-login.php?redirect_to=' . $goto ); 
    386     echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); 
    387160} else { 
    388161    $stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default'; 
     
    392165                validate_user_signup(); 
    393166            else 
    394                 _e( 'User registration has been disabled.' ); 
     167                _e( 'User registration has been disabled.', 'helfjmm' ); 
    395168        break; 
    396         case 'validate-blog-signup': 
    397             if ( $active_signup == 'all' || $active_signup == 'blog' ) 
    398                 validate_blog_signup(); 
    399             else 
    400                 _e( 'Site registration has been disabled.' ); 
    401             break; 
    402         case 'gimmeanotherblog': 
    403             validate_another_blog_signup(); 
    404             break; 
    405169        case 'default': 
    406170        default : 
    407171            $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; 
    408172            do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere? 
    409             if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) 
    410                 signup_another_blog($newblogname); 
    411             elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) 
    412                 signup_user( $newblogname, $user_email ); 
    413             elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) 
    414                 _e( 'Sorry, new registrations are not allowed at this time.' ); 
     173            if ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) 
     174                signup_user( $user_email ); 
    415175            else 
    416                 _e( 'You are logged in already. No need to register again!' ); 
    417  
    418             if ( $newblogname ) { 
    419                 $newblog = get_blogaddress_by_name( $newblogname ); 
    420  
    421                 if ( $active_signup == 'blog' || $active_signup == 'all' ) 
    422                     printf( __( '<p><em>The site you were looking for, <strong>%s</strong> does not exist, but you can create it now!</em></p>' ), $newblog ); 
    423                 else 
    424                     printf( __( '<p><em>The site you were looking for, <strong>%s</strong>, does not exist.</em></p>' ), $newblog ); 
    425             } 
     176                _e( 'You are logged in already. No need to register again!', 'helfjmm' ); 
    426177            break; 
    427178    } 
  • join-my-multisite/trunk/readme.txt

    r611707 r611734  
    5858= What happens if the network doesn't allow registrations? = 
    5959 
    60 Then your non-logged in users see nothing. 
     60If registration is turned off, the widget won't display anything for logged-out users. 
     61 
     62The <code>[join-my-multisite]</code> shortcode will display a notice that registration is unavailable. 
    6163 
    6264= How do I style the button? = 
     
    6668= How do I style the per-site registration page? = 
    6769 
    68 In your theme's CSS. This is basically the default WordPress signup page, just done in short-code form, so it will default to use your site's CSS anyway. 
     70In your theme's CSS. This is basically the default WordPress signup page, just done in short-code form, so it will default to use your site's CSS anyway. The css falls under `.mu_register` so you can override it in your theme. 
     71 
     72= Can users sign up for a blog as well as an account? = 
     73 
     74No.  
     75 
     76That's such a massive network thing, the tinfoil hat in me didn't want to do it. You could fiddle with the signup page code, if you wanted, but I don't plan to support it. 
Note: See TracChangeset for help on using the changeset viewer.