Ticket #25381: wp-signup.9.diff
File wp-signup.9.diff, 9.0 KB (added by , 11 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 site sign-up 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 site sign-up 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 site sign-up form. 143 * 144 * @since 3.0.0 145 * 146 * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors. 147 */ 148 do_action( 'signup_blogform', $errors ); 132 149 } 133 150 134 151 /** … … 176 193 if ( $errmsg = $errors->get_error_message('generic') ) { 177 194 echo '<p class="error">' . $errmsg . '</p>'; 178 195 } 196 /** 197 * Add extra fields to the user registration form on the site sign-up form. 198 * 199 * @since 3.0.0 200 * 201 * @param array $errors An array possibly containing 'user_name' or 'user_email' errors. 202 */ 179 203 do_action( 'signup_extra_fields', $errors ); 180 204 } 181 205 … … 209 233 $errors = new WP_Error(); 210 234 } 211 235 212 // allow definition of default variables 213 $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 236 $signup_defaults = array( 237 'blogname' => $blogname, 238 'blog_title' => $blog_title, 239 'errors' => $errors 240 ); 241 242 /** 243 * Filter the default site sign-up variables. 244 * 245 * @since 3.0.0 246 * 247 * @param array $signup_defaults { 248 * An array of default site sign-up variables. 249 * 250 * @type string $blogname The site blogname. 251 * @type string $blog_title The site title. 252 * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors. 253 * } 254 */ 255 $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); 256 214 257 $blogname = $filtered_results['blogname']; 215 258 $blog_title = $filtered_results['blog_title']; 216 259 $errors = $filtered_results['errors']; … … 241 284 <input type="hidden" name="stage" value="gimmeanotherblog" /> 242 285 <?php 243 286 /** 244 * Hidden sign up form fields output forcreating another site.287 * Hidden sign-up form fields output when creating another site. 245 288 * 246 289 * @since MU 247 290 * 248 * @param string $context A string describing the step of the signup process. the value can be291 * @param string $context A string describing the steps of the sign-up process. The value can be 249 292 * 'create-another-site', 'validate-user', or 'validate-site'. 250 293 */ 251 294 do_action( 'signup_hidden_fields', 'create-another-site' ); … … 281 324 } 282 325 283 326 $public = (int) $_POST['blog_public']; 284 $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated 327 328 $blog_meta_defaults = array( 329 'lang_id' => 1, 330 'public' => $public 331 ); 332 333 /** 334 * Filter the new site meta variables. 335 * 336 * @since MU 337 * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead. 338 * 339 * @param array $blog_meta_defaults An array of default blog meta variables. 340 */ 341 $meta = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); 342 /** 343 * Filter the new default site meta variables. 344 * 345 * @since 3.0.0 346 * 347 * @param array $meta { 348 * An array of default site meta variables. 349 * 350 * @type int $lang_id The language ID. 351 * @type int $blog_public Whether the blog is indexable by search engines. 1 for true, 0 for false. 352 * } 353 */ 285 354 $meta = apply_filters( 'add_signup_meta', $meta ); 286 355 287 356 wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); … … 307 376 <?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 377 </p> 309 378 <?php 379 /** 380 * Fires when the site sign-up process is complete. 381 * 382 * @since 3.0.0 383 */ 310 384 do_action( 'signup_finished' ); 311 385 } 312 386 … … 329 403 330 404 $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; 331 405 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 )); 406 $signup_user_defaults = array( 407 'user_name' => $user_name, 408 'user_email' => $user_email, 409 'errors' => $errors, 410 ); 411 412 /** 413 * Filter the default user variables used on the site sign-up form. 414 * 415 * @since 3.0.0 416 * 417 * @param array $signup_user_defaults { 418 * An array of default user variables. 419 * 420 * @type string $user_name The user username. 421 * @type string $user_email The user email address. 422 * @type array $errors An array of possible errors relevant to the sign-up user. 423 * } 424 */ 425 $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); 334 426 $user_name = $filtered_results['user_name']; 335 427 $user_email = $filtered_results['user_email']; 336 428 $errors = $filtered_results['errors']; … … 389 481 return false; 390 482 } 391 483 392 wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); 484 //duplicate_hook 485 wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); 393 486 394 487 confirm_user_signup($user_name, $user_email); 395 488 return true; … … 410 503 <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p> 411 504 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> 412 505 <?php 506 //duplicate_hook 413 507 do_action( 'signup_finished' ); 414 508 } 415 509 … … 430 524 if ( !is_wp_error($errors) ) 431 525 $errors = new WP_Error(); 432 526 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 )); 527 $signup_blog_defaults = array( 528 'user_name' => $user_name, 529 'user_email' => $user_email, 530 'blogname' => $blogname, 531 'blog_title' => $blog_title, 532 'errors' => $errors 533 ); 534 535 /** 536 * Filter the default site creation variables for the site sign-up form. 537 * 538 * @since 3.0.0 539 * 540 * @param array $signup_blog_defaults { 541 * An array of default site creation variables. 542 * 543 * @type string $user_name The user username. 544 * @type string $user_email The user email address. 545 * @type string $blogname The blogname. 546 * @type string $blog_title The title of the site. 547 * @type array $errors An array of possible errors relevant to new site creation variables. 548 * } 549 */ 550 $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults ); 551 435 552 $user_name = $filtered_results['user_name']; 436 553 $user_email = $filtered_results['user_email']; 437 554 $blogname = $filtered_results['blogname']; … … 487 604 488 605 $public = (int) $_POST['blog_public']; 489 606 $meta = array ('lang_id' => 1, 'public' => $public); 607 608 //duplicate_hook 490 609 $meta = apply_filters( 'add_signup_meta', $meta ); 491 610 492 611 wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); … … 523 642 </ul> 524 643 </p> 525 644 <?php 645 //duplicate_hook 526 646 do_action( 'signup_finished' ); 527 647 } 528 648 529 649 // Main 530 650 $active_signup = get_site_option( 'registration', 'none' ); 531 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user" 651 /** 652 * Filter the type of site sign-up. 653 * 654 * @since 3.0.0 655 * 656 * @param string $active_signup String that returns registration type. The value can be 657 * 'all', 'none', 'blog', or 'user'. 658 */ 659 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); 532 660 533 661 // Make the signup type translatable. 534 662 $i18n_signup['all'] = _x('all', 'Multisite active signup type'); … … 568 696 case 'default': 569 697 default : 570 698 $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; 571 do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere? 699 /** 700 * Fires when the site sign-up form is sent. 701 * 702 * @since 3.0.0 703 */ 704 do_action( 'preprocess_signup_form' ); 572 705 if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) 573 706 signup_another_blog($newblogname); 574 707 elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) … … 592 725 ?> 593 726 </div> 594 727 </div> 595 <?php do_action( 'after_signup_form' ); ?> 728 <?php 729 /** 730 * Fires after the site sign-up form, before wp_footer. 731 * 732 * @since 3.0.0 733 */ 734 do_action( 'after_signup_form' ); ?> 596 735 597 736 <?php get_footer(); ?>