Ticket #25381: wp-signup.6.diff
| File wp-signup.6.diff, 7.8 KB (added by , 12 years ago) |
|---|
-
src/wp-signup.php
18 18 * @since MU 19 19 */ 20 20 function do_signup_header() { 21 /** 22 * Fires within the <head> section of the signup screen. 23 * 24 * @since 3.0.0 25 */ 21 26 do_action( 'signup_header' ); 22 27 } 23 28 add_action( 'wp_head', 'do_signup_header' ); … … 63 68 add_action( 'wp_head', 'wpmu_signup_stylesheet' ); 64 69 get_header(); 65 70 71 /** 72 * Fires before the signup form. 73 * 74 * @since 3.0.0 75 */ 66 76 do_action( 'before_signup_form' ); 67 77 ?> 68 78 <div id="content" class="widecolumn"> … … 128 138 </div> 129 139 130 140 <?php 131 do_action('signup_blogform', $errors); 141 /** 142 * Fires after the signup form. 143 * 144 * @since 3.0.0 145 */ 146 do_action( 'signup_blogform', $errors ); 132 147 } 133 148 134 149 /** … … 176 191 if ( $errmsg = $errors->get_error_message('generic') ) { 177 192 echo '<p class="error">' . $errmsg . '</p>'; 178 193 } 194 /** 195 * Add extra fields to the user registration form. 196 * 197 * @since 3.0.0 198 */ 179 199 do_action( 'signup_extra_fields', $errors ); 180 200 } 181 201 … … 209 229 $errors = new WP_Error(); 210 230 } 211 231 212 // allow definition of default variables 213 $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 232 $signup_defaults = array( 233 'blogname' => $blogname, 234 'blog_title' => $blog_title, 235 'errors' => $errors 236 ); 237 238 /** 239 * Filter the default site signup variables. 240 * 241 * @since 3.0.0 242 * 243 * @param array $signup_defaults An array of default site signup variables. 244 */ 245 $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); 214 246 $blogname = $filtered_results['blogname']; 215 247 $blog_title = $filtered_results['blog_title']; 216 248 $errors = $filtered_results['errors']; … … 241 273 <input type="hidden" name="stage" value="gimmeanotherblog" /> 242 274 <?php 243 275 /** 244 * Hidden signup form fields output forcreating another site.276 * Hidden signup form fields output when creating another site. 245 277 * 246 278 * @since MU 247 279 * 248 * @param string $context A string describing the step of the signup process. the value can be280 * @param string $context A string describing the steps of the signup process. The value can be 249 281 * 'create-another-site', 'validate-user', or 'validate-site'. 250 282 */ 251 283 do_action( 'signup_hidden_fields', 'create-another-site' ); … … 281 313 } 282 314 283 315 $public = (int) $_POST['blog_public']; 284 $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated 316 317 $blog_meta_defaults = array( 318 'lang_id' => 1, 319 'public' => $public 320 ); 321 322 /** 323 * Filter the new blog meta variables. 324 * 325 * @since 3.0.0 326 * @deprecated 3.0.0 327 * 328 * @param array $blog_meta_defaults An array of default blog meta variables. 329 */ 330 $meta = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); 331 /** 332 * Filter the new default site meta variables. 333 * 334 * @since 3.0.0 335 * 336 * @param array $meta An array of default site meta variables. 337 */ 285 338 $meta = apply_filters( 'add_signup_meta', $meta ); 286 339 287 340 wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); … … 307 360 <?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 ) ?> 308 361 </p> 309 362 <?php 363 /** 364 * Fires when the signup process is complete. 365 * 366 * @since 3.0.0 367 */ 310 368 do_action( 'signup_finished' ); 311 369 } 312 370 … … 329 387 330 388 $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; 331 389 332 // allow definition of default variables 333 $filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors )); 390 $signup_user_default = array( 391 'user_name' => $user_name, 392 'user_email' => $user_email, 393 'errors' => $errors, 394 ); 395 396 /** 397 * Filter the default user variables. 398 * 399 * @since 3.0.0 400 * 401 * @param array $signup_user_default An array of default user variables. 402 */ 403 $filtered_results = apply_filters( 'signup_user_init', $signup_user_default ); 334 404 $user_name = $filtered_results['user_name']; 335 405 $user_email = $filtered_results['user_email']; 336 406 $errors = $filtered_results['errors']; … … 389 459 return false; 390 460 } 391 461 392 wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ));462 $optional_signup_meta = array(); 393 463 464 //duplicate_hook 465 $meta = apply_filters( 'add_signup_meta', $optional_signup_meta ); 466 467 wpmu_signup_user( $user_name, $user_email, $meta ); 468 394 469 confirm_user_signup($user_name, $user_email); 395 470 return true; 396 471 } … … 410 485 <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p> 411 486 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> 412 487 <?php 488 //duplicate_hook 413 489 do_action( 'signup_finished' ); 414 490 } 415 491 … … 430 506 if ( !is_wp_error($errors) ) 431 507 $errors = new WP_Error(); 432 508 433 // allow definition of default variables 434 $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 509 $signup_blog_default = array( 510 'user_name' => $user_name, 511 'user_email' => $user_email, 512 'blogname' => $blogname, 513 'blog_title' => $blog_title, 514 'errors' => $errors 515 ); 516 517 /** 518 * Filter the default site creation variables. 519 * 520 * @since 3.0.0 521 * 522 * @param array $signup_blog_default An array of default site creation variables. 523 */ 524 $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_default ); 435 525 $user_name = $filtered_results['user_name']; 436 526 $user_email = $filtered_results['user_email']; 437 527 $blogname = $filtered_results['blogname']; … … 487 577 488 578 $public = (int) $_POST['blog_public']; 489 579 $meta = array ('lang_id' => 1, 'public' => $public); 580 581 //duplicate_hook 490 582 $meta = apply_filters( 'add_signup_meta', $meta ); 491 583 492 584 wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); … … 523 615 </ul> 524 616 </p> 525 617 <?php 618 //duplicate_hook 526 619 do_action( 'signup_finished' ); 527 620 } 528 621 529 622 // Main 530 623 $active_signup = get_site_option( 'registration', 'none' ); 531 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user" 624 /** 625 * Filter the type of signup. 626 * 627 * @since 3.0.0 628 * 629 * @param string $active_signup String that returns registration type. The value can be 630 * 'all', 'none', 'blog', or 'user'. 631 */ 632 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); 532 633 533 634 // Make the signup type translatable. 534 635 $i18n_signup['all'] = _x('all', 'Multisite active signup type'); … … 568 669 case 'default': 569 670 default : 570 671 $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; 571 do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere? 672 /** 673 * Fires when the signup form is sent. 674 * 675 * @since 3.0.0 676 */ 677 do_action( 'preprocess_signup_form' ); 572 678 if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) 573 679 signup_another_blog($newblogname); 574 680 elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) … … 592 698 ?> 593 699 </div> 594 700 </div> 595 <?php do_action( 'after_signup_form' ); ?> 701 <?php 702 /** 703 * Fires after the signup form, before wp_footer. 704 * 705 * @since 3.0.0 706 */ 707 do_action( 'after_signup_form' ); ?> 596 708 597 709 <?php get_footer(); ?>