Ticket #22187: 22187.4.diff
File 22187.4.diff, 25.9 KB (added by , 12 years ago) |
---|
-
wp-signup.php
12 12 die(); 13 13 } 14 14 15 /** 16 * Prints signup_header via wp_head 17 * 18 * @since 3.0.0 19 */ 15 20 function do_signup_header() { 16 21 do_action( 'signup_header' ); 17 22 } 18 23 add_action( 'wp_head', 'do_signup_header' ); 19 24 20 if ( ! is_multisite() ) {21 wp_redirect( site_url( 'wp-login.php?action=register') );25 if ( ! is_multisite() ) { 26 wp_redirect( site_url( 'wp-login.php?action=register' ) ); 22 27 die(); 23 28 } 24 29 25 if ( ! is_main_site() ) {30 if ( ! is_main_site() ) { 26 31 wp_redirect( network_site_url( 'wp-signup.php' ) ); 27 32 die(); 28 33 } … … 30 35 // Fix for page title 31 36 $wp_query->is_404 = false; 32 37 38 /** 39 * Prints styles for front-end Multisite signup pages. 40 * 41 * The default styles are printed via signup_header which is hooked to wp_head. 42 * They can be overloaded by replacing the output on the signup_header action hook. 43 * 44 * @since 3.0.0 45 */ 33 46 function wpmu_signup_stylesheet() { 34 47 ?> 35 48 <style type="text/css"> … … 50 63 <?php 51 64 } 52 65 53 add_action( 'wp_head', 'wpmu_signup_stylesheet' );54 66 get_header(); 55 67 56 68 do_action( 'before_signup_form' ); … … 58 70 <div id="content" class="widecolumn"> 59 71 <div class="mu_register"> 60 72 <?php 61 function show_blog_form($blogname = '', $blog_title = '', $errors = '') { 73 /** 74 * Generates and displays the Signup and Create Site forms 75 * 76 * @since 3.0.0 77 * 78 * @param string $blogname 79 * @param string $blog_title 80 * @param array $errors 81 */ 82 function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { 62 83 global $current_site; 63 84 // Blog name 64 if ( ! is_subdomain_install() )65 echo '<label for="blogname">' . __('Site Name:') . '</label>';85 if ( ! is_subdomain_install() ) 86 printf( '<label for="blogname">%s</label>', __('Site Name:') ); 66 87 else 67 echo '<label for="blogname">' . __('Site Domain:') . '</label>';88 printf( '<label for="blogname">%s</label>', __('Site Domain:') ); 68 89 69 if ( $errmsg = $errors->get_error_message( 'blogname') ) { ?>90 if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { ?> 70 91 <p class="error"><?php echo $errmsg ?></p> 71 92 <?php } 72 93 73 if ( !is_subdomain_install() ) 74 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 />'; 75 else 76 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 />'; 77 78 if ( !is_user_logged_in() ) { 79 if ( !is_subdomain_install() ) 94 if ( ! is_subdomain_install() ) { 95 printf( '<span class="prefix_address">%1$s</span><input name="blogname" type="text" id="blogname" value="%2$s" maxlength="60" /><br />', 96 $current_site->domain . $current_site->path, 97 esc_attr( $blogname ) 98 ); 99 } else { 100 printf( '<input name="blogname" type="text" id="blogname" value="%1$s" maxlength="60" /><span class="suffix_address">( %2$s )</span><br />', 101 esc_attr( $blogname ), 102 $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) 103 ); 104 } 105 106 if ( ! is_user_logged_in() ) { 107 if ( ! is_subdomain_install() ) { 80 108 $site = $current_site->domain . $current_site->path . __( 'sitename' ); 81 else109 } else { 82 110 $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; 83 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>'; 111 $address = sprintf( __('Your address will be %s.'), $site ); 112 113 printf( '<p>(<strong>%1$s</strong>)%2$s</p>', 114 $address, 115 __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) 116 ); 117 } 84 118 } 85 119 86 120 // Blog Title 87 121 ?> 88 <label for="blog_title"><?php _e('Site Title:') ?></label> 89 <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> 122 <label for="blog_title"><?php _e( 'Site Title:' ) ?></label> 123 124 <?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?> 90 125 <p class="error"><?php echo $errmsg ?></p> 91 126 <?php } 92 echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />'; 127 128 printf( '<input name="blog_title" type="text" id="blog_title" value="%s" />', esc_attr( $blog_title ) ); 93 129 ?> 94 130 95 131 <div id="privacy"> 96 132 <p class="privacy-intro"> 97 <label for="blog_public_on"><?php _e( 'Privacy:') ?></label>133 <label for="blog_public_on"><?php _e( 'Privacy:' ) ?></label> 98 134 <?php _e( 'Allow search engines to index this site.' ); ?> 99 135 <br style="clear:both" /> 100 136 <label class="checkbox" for="blog_public_on"> … … 109 145 </div> 110 146 111 147 <?php 112 do_action( 'signup_blogform', $errors);148 do_action( 'signup_blogform', $errors ); 113 149 } 114 150 151 /** 152 * {@internal Missing Short Description}} 153 * 154 * @since 3.0.0 155 * 156 * @uses wp_get_current_user() 157 * @return array 158 */ 115 159 function validate_blog_form() { 116 160 $user = ''; 117 161 if ( is_user_logged_in() ) … … 120 164 return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); 121 165 } 122 166 123 function show_user_form($user_name = '', $user_email = '', $errors = '') { 167 /** 168 * {@internal Missing Short Description}} 169 * 170 * @since 3.0.0 171 * 172 * @param string $user_name 173 * @param string $user_email 174 * @param array $errors 175 */ 176 function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { 124 177 // User name 125 echo '<label for="user_name">' . __('Username:') . '</label>'; 126 if ( $errmsg = $errors->get_error_message('user_name') ) { 127 echo '<p class="error">'.$errmsg.'</p>'; 128 } 129 echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />'; 130 _e( '(Must be at least 4 characters, letters and numbers only.)' ); 131 ?> 178 printf( '<label for="user_name">%s</label>', __( 'Username:' ) ); 132 179 180 if ( $errmsg = $errors->get_error_message( 'user_name' ) ) { ?> 181 <p class="error"><?php echo $errmsg; ?></p> 182 <?php } ?> 183 184 <input name="user_name" type="text" id="user_name" value="<?php echo $esc_attr( $user_name ); ?>" maxlength="60" /><br /> 185 <?php _e( '(Must be at least 4 characters, letters and numbers only.)' ); ?> 186 133 187 <label for="user_email"><?php _e( 'Email Address:' ) ?></label> 188 134 189 <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> 135 190 <p class="error"><?php echo $errmsg ?></p> 136 191 <?php } ?> 137 <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.)') ?> 192 193 <input name="user_email" type="text" id="user_email" value="<?php echo esc_attr( $user_email ) ?>" maxlength="200" /><br /> 194 <?php _e( 'We send your registration email to this address. (Double-check your email address before continuing.)' ); ?> 138 195 <?php 139 if ( $errmsg = $errors->get_error_message('generic') ) { 140 echo '<p class="error">' . $errmsg . '</p>'; 141 } 196 if ( $errmsg = $errors->get_error_message('generic') ) { ?> 197 <p class="error"><?php echo $errmsg; ?></p> 198 <?php } 199 142 200 do_action( 'signup_extra_fields', $errors ); 143 201 } 144 202 203 /** 204 * {@internal Missing Short Description}} 205 * 206 * @since 3.0.0 207 * 208 * @return array 209 */ 145 210 function validate_user_form() { 146 211 return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); 147 212 } 148 213 149 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { 214 /** 215 * {@internal Missing Short Description}} 216 * 217 * @since 3.0.0 218 * 219 * @uses wp_get_current_user() 220 * @param string $blogname 221 * @param string $blog_title 222 * @param array $errors 223 */ 224 function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { 150 225 global $current_site; 151 226 $current_user = wp_get_current_user(); 152 227 … … 155 230 } 156 231 157 232 // allow definition of default variables 158 $filtered_results = apply_filters( 'signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));233 $filtered_results = apply_filters( 'signup_another_blog_init', array( 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ) ); 159 234 $blogname = $filtered_results['blogname']; 160 235 $blog_title = $filtered_results['blog_title']; 161 236 $errors = $filtered_results['errors']; 162 237 163 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';238 printf( '<h2>%s</h2>', sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) ); 164 239 165 if ( $errors->get_error_code() ) { 166 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; 167 } 240 if ( $errors->get_error_code() ) 241 printf( '<p>%s</p>', __( 'There was a problem, please correct the form below and try again.' ) ); 168 242 ?> 169 <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’s content, but write responsibly!' ), $current_user->display_name ) ?></p> 243 <p> 244 <?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’s content, but write responsibly!' ), $current_user->display_name ); ?> 245 </p> 170 246 171 247 <?php 172 $blogs = get_blogs_of_user( $current_user->ID);173 if ( ! empty($blogs) ) { ?>248 $blogs = get_blogs_of_user( $current_user->ID ); 249 if ( ! empty( $blogs ) ) { ?> 174 250 175 <p><?php _e( 'Sites you are already a member of:' ) ?></p>251 <p><?php _e( 'Sites you are already a member of:' ); ?></p> 176 252 <ul> 177 253 <?php foreach ( $blogs as $blog ) { 178 254 $home_url = get_home_url( $blog->userblog_id ); 179 echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';255 printf( '<li><a href="%1$s">%2$s</a></li>', esc_url( $home_url ), $home_url ); 180 256 } ?> 181 257 </ul> 182 258 <?php } ?> 183 259 184 <p><?php _e( 'If you’re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>260 <p><?php _e( 'If you’re not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p> 185 261 <form id="setupform" method="post" action="wp-signup.php"> 186 262 <input type="hidden" name="stage" value="gimmeanotherblog" /> 187 263 <?php do_action( 'signup_hidden_fields' ); ?> 188 <?php show_blog_form( $blogname, $blog_title, $errors); ?>189 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>264 <?php show_blog_form( $blogname, $blog_title, $errors ); ?> 265 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ); ?>" /></p> 190 266 </form> 191 267 <?php 192 268 } 193 269 270 /** 271 * {@internal Missing Short Description}} 272 * 273 * @since 3.0.0 274 * 275 * @uses validate_blog_form() 276 * @return bool 277 */ 194 278 function validate_another_blog_signup() { 195 279 global $wpdb, $blogname, $blog_title, $errors, $domain, $path; 196 280 $current_user = wp_get_current_user(); 197 if ( ! is_user_logged_in() )281 if ( ! is_user_logged_in() ) 198 282 die(); 199 283 200 284 $result = validate_blog_form(); 201 extract( $result);285 extract( $result ); 202 286 203 287 if ( $errors->get_error_code() ) { 204 signup_another_blog( $blogname, $blog_title, $errors);288 signup_another_blog( $blogname, $blog_title, $errors ); 205 289 return false; 206 290 } 207 291 … … 210 294 $meta = apply_filters( 'add_signup_meta', $meta ); 211 295 212 296 wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); 213 confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); 297 298 confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta ); 299 214 300 return true; 215 301 } 216 302 217 function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') { 303 /** 304 * {@internal Missing Short Description}} 305 * 306 * @since 3.0.0 307 * 308 * @todo Check for ssl 309 * @param string $domain 310 * @param string $path 311 * @param string $user_name 312 * @param string $user_email 313 * @param string $meta 314 */ 315 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) { 218 316 ?> 219 317 <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 220 318 <p> 221 <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> 319 <?php 320 printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.' ), 321 $domain.$path, 322 $domain.$path, 323 "http://" . $domain.$path . "wp-login.php", $user_name 324 ); 325 ?> 222 326 </p> 223 327 <?php 224 328 do_action( 'signup_finished' ); 225 329 } 226 330 227 function signup_user($user_name = '', $user_email = '', $errors = '') { 331 /** 332 * {@internal Missing Short Description}} 333 * 334 * @since 3.0.0 335 * 336 * @todo Update button styles 337 * @uses apply_filters() 338 * @param string $user_name 339 * @param string $user_email 340 * @param array $errors 341 */ 342 function signup_user( $user_name = '', $user_email = '', $errors = '' ) { 228 343 global $current_site, $active_signup; 229 344 230 if ( ! is_wp_error($errors) )345 if ( ! is_wp_error( $errors ) ) 231 346 $errors = new WP_Error(); 232 347 233 348 $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; 234 349 235 350 // allow definition of default variables 236 $filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors )); 351 $filtered_results = apply_filters( 'signup_user_init', array( 352 'user_name' => $user_name, 353 'user_email' => $user_email, 354 'errors' => $errors 355 ) ); 356 237 357 $user_name = $filtered_results['user_name']; 238 358 $user_email = $filtered_results['user_email']; 239 359 $errors = $filtered_results['errors']; … … 241 361 ?> 242 362 243 363 <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2> 364 244 365 <form id="setupform" method="post" action="wp-signup.php"> 245 366 <input type="hidden" name="stage" value="validate-user-signup" /> 246 367 <?php do_action( 'signup_hidden_fields' ); ?> 368 247 369 <?php show_user_form($user_name, $user_email, $errors); ?> 248 370 249 371 <p> … … 260 382 <?php } ?> 261 383 </p> 262 384 263 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next') ?>" /></p>264 </form> 385 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ) ?>" /></p> 386 </form><!-- #setupform --> 265 387 <?php 266 388 } 267 389 390 /** 391 * {@internal Missing Short Description}} 392 * 393 * @since 3.0.0 394 * 395 * @uses signup_user() 396 * @uses signup_blog() 397 * @uses wpmu_signup_user() 398 * @uses confirm_user_signup() 399 * @return bool 400 */ 268 401 function validate_user_signup() { 269 402 $result = validate_user_form(); 270 extract( $result);403 extract( $result ); 271 404 272 405 if ( $errors->get_error_code() ) { 273 signup_user( $user_name, $user_email, $errors);406 signup_user( $user_name, $user_email, $errors ); 274 407 return false; 275 408 } 276 409 277 410 if ( 'blog' == $_POST['signup_for'] ) { 278 signup_blog( $user_name, $user_email);411 signup_blog( $user_name, $user_email ); 279 412 return false; 280 413 } 281 414 282 wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );415 wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); 283 416 284 confirm_user_signup( $user_name, $user_email);417 confirm_user_signup( $user_name, $user_email ); 285 418 return true; 286 419 } 287 420 288 function confirm_user_signup($user_name, $user_email) { 421 /** 422 * {@internal Missing Short Description}} 423 * 424 * @since 3.0.0 425 * 426 * @param string $user_name 427 * @param string $user_email 428 */ 429 function confirm_user_signup( $user_name, $user_email ) { 289 430 ?> 290 431 <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2> 291 432 <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p> … … 295 436 do_action( 'signup_finished' ); 296 437 } 297 438 298 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { 299 if ( !is_wp_error($errors) ) 439 /** 440 * {@internal Missing Short Description}} 441 * 442 * @since 3.0.0 443 * 444 * @uses apply_filters() 445 * @uses show_blog_form() 446 * @param string $user_name 447 * @param string $user_email 448 * @param string $blogname 449 * @param string $blog_title 450 * @param array $errors 451 */ 452 function signup_blog( $user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '' ) { 453 if ( ! is_wp_error( $errors ) ) 300 454 $errors = new WP_Error(); 301 455 302 456 // allow definition of default variables 303 $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 457 $filtered_results = apply_filters( 'signup_blog_init', array( 458 'user_name' => $user_name, 459 'user_email' => $user_email, 460 'blogname' => $blogname, 461 'blog_title' => $blog_title, 462 'errors' => $errors 463 ) ); 464 304 465 $user_name = $filtered_results['user_name']; 305 466 $user_email = $filtered_results['user_email']; 306 467 $blogname = $filtered_results['blogname']; 307 468 $blog_title = $filtered_results['blog_title']; 308 469 $errors = $filtered_results['errors']; 309 470 310 if ( empty( $blogname) )471 if ( empty( $blogname ) ) 311 472 $blogname = $user_name; 312 473 ?> 313 474 <form id="setupform" method="post" action="wp-signup.php"> … … 315 476 <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" /> 316 477 <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" /> 317 478 <?php do_action( 'signup_hidden_fields' ); ?> 318 <?php show_blog_form( $blogname, $blog_title, $errors); ?>319 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Signup') ?>" /></p>320 </form> 479 <?php show_blog_form( $blogname, $blog_title, $errors ); ?> 480 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Signup' ) ?>" /></p> 481 </form><!-- #setupform --> 321 482 <?php 322 483 } 323 484 485 /** 486 * {@internal Missing Short Description}} 487 * 488 * @since 3.0.0 489 * 490 * @uses wpmu_validate_user_signup() 491 * @uses wpmu_validate_blog_signup() 492 * @uses signup_user() 493 * @uses signup_blog() 494 * @uses apply_filters() 495 * @return bool 496 */ 324 497 function validate_blog_signup() { 325 498 // Re-validate user info. 326 $result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email']);327 extract( $result);499 $result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); 500 extract( $result ); 328 501 329 502 if ( $errors->get_error_code() ) { 330 signup_user( $user_name, $user_email, $errors);503 signup_user( $user_name, $user_email, $errors ); 331 504 return false; 332 505 } 333 506 334 $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title']);335 extract( $result);507 $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] ); 508 extract( $result ); 336 509 337 510 if ( $errors->get_error_code() ) { 338 signup_blog( $user_name, $user_email, $blogname, $blog_title, $errors);511 signup_blog( $user_name, $user_email, $blogname, $blog_title, $errors ); 339 512 return false; 340 513 } 341 514 … … 343 516 $meta = array ('lang_id' => 1, 'public' => $public); 344 517 $meta = apply_filters( 'add_signup_meta', $meta ); 345 518 346 wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta);347 confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta);519 wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 520 confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 348 521 return true; 349 522 } 350 523 351 function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) { 524 /** 525 * {@internal Missing Short Description}} 526 * 527 * @since 3.0.0 528 * 529 * @param string $domain 530 * @param string $path 531 * @param string $blog_title 532 * @param string $user_name 533 * @param string $user_email 534 * @param string $meta 535 */ 536 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta ) { 352 537 ?> 353 538 <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> 354 539 355 540 <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p> 356 <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ) ?></p>541 <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ) ?></p> 357 542 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> 358 543 <h2><?php _e( 'Still waiting for your email?' ); ?></h2> 359 544 <p> … … 362 547 <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> 363 548 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li> 364 549 <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email ) ?></li> 365 </ul> 550 </ul><!-- .noemail-tips --> 366 551 </p> 367 552 <?php 368 553 do_action( 'signup_finished' ); … … 370 555 371 556 // Main 372 557 $active_signup = get_site_option( 'registration' ); 373 if ( ! $active_signup )558 if ( ! $active_signup ) 374 559 $active_signup = 'all'; 375 560 376 561 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user" 377 562 378 563 // Make the signup type translatable. 379 $i18n_signup['all'] = _x( 'all', 'Multisite active signup type');380 $i18n_signup['none'] = _x( 'none', 'Multisite active signup type');381 $i18n_signup['blog'] = _x( 'blog', 'Multisite active signup type');382 $i18n_signup['user'] = _x( 'user', 'Multisite active signup type');564 $i18n_signup['all'] = _x( 'all', 'Multisite active signup type' ); 565 $i18n_signup['none'] = _x( 'none', 'Multisite active signup type' ); 566 $i18n_signup['blog'] = _x( 'blog', 'Multisite active signup type' ); 567 $i18n_signup['user'] = _x( 'user', 'Multisite active signup type' ); 383 568 384 if ( is_super_admin() ) 385 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="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; 569 if ( is_super_admin() ) { 570 $allowed_registrations = sprintf( __( 'Greetings Site Administrator! You are currently allowing “%1$s” registrations. To change or disable registration go to your <a href="%2$s">Options page</a>.' ), 571 $i18n_signup[$active_signup], 572 esc_url( network_admin_url( 'settings.php' ) ) 573 ); 574 printf( '<div class="mu_alert">%s</div>', $allowed_registrations ); 575 } 386 576 387 577 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; 388 578 389 579 $current_user = wp_get_current_user(); 390 580 if ( $active_signup == 'none' ) { 391 581 _e( 'Registration has been disabled.' ); 392 } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) {582 } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) { 393 583 $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) ); 394 echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );584 printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); 395 585 } else { 396 $stage = isset( $_POST['stage'] ) ? 586 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; 397 587 switch ( $stage ) { 398 588 case 'validate-user-signup' : 399 if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) 589 if ( $active_signup == 'all' 590 || ( $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' ) 591 || ( $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) ) 400 592 validate_user_signup(); 401 593 else 402 594 _e( 'User registration has been disabled.' ); … … 415 607 $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; 416 608 do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere? 417 609 if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) 418 signup_another_blog( $newblogname);419 elseif ( is_user_logged_in() == false&& ( $active_signup == 'all' || $active_signup == 'user' ) )610 signup_another_blog( $newblogname ); 611 elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) 420 612 signup_user( $newblogname, $user_email ); 421 elseif ( is_user_logged_in() == false&& ( $active_signup == 'blog' ) )613 elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) 422 614 _e( 'Sorry, new registrations are not allowed at this time.' ); 423 615 else 424 616 _e( 'You are logged in already. No need to register again!' ); … … 435 627 } 436 628 } 437 629 ?> 438 </div> 439 </div> 630 </div><!-- .mu_register --> 631 </div><!-- #content --> 440 632 <?php do_action( 'after_signup_form' ); ?> 441 633 442 634 <?php get_footer(); ?> -
wp-includes/default-filters.php
213 213 add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); 214 214 add_action( 'init', 'check_theme_switched', 99 ); 215 215 add_action( 'after_switch_theme', '_wp_sidebars_changed' ); 216 add_action( 'signup_header', 'wpmu_signup_stylesheet' ); 216 217 217 218 if ( isset( $_GET['replytocom'] ) ) 218 219 add_action( 'wp_head', 'wp_no_robots' );