Make WordPress Core

Ticket #25381: wp-signup.5.diff

File wp-signup.5.diff, 7.6 KB (added by miyauchi, 12 years ago)

patch for r25600

  • wp-signup.php

     
    1818 * @since MU
    1919 */
    2020function do_signup_header() {
     21        /**
     22         * Fires within the <head></head> section of the sign up screen.
     23         *
     24         * @since 3.0.0
     25         */
    2126        do_action( 'signup_header' );
    2227}
    2328add_action( 'wp_head', 'do_signup_header' );
     
    6368add_action( 'wp_head', 'wpmu_signup_stylesheet' );
    6469get_header();
    6570
     71/**
     72 * Fires before sign up form on the sign up screen.
     73 *
     74 * @since 3.0.0
     75 */
    6676do_action( 'before_signup_form' );
    6777?>
    6878<div id="content" class="widecolumn">
     
    128138        </div>
    129139
    130140        <?php
     141        /**
     142         * Fires after sign up blog form.
     143         *
     144         * @since 3.0.0
     145         */
    131146        do_action('signup_blogform', $errors);
    132147}
    133148
     
    176191        if ( $errmsg = $errors->get_error_message('generic') ) {
    177192                echo '<p class="error">' . $errmsg . '</p>';
    178193        }
     194        /**
     195         * Add extra fields to the user registration form.
     196         *
     197         * @since 3.0.0
     198         */
    179199        do_action( 'signup_extra_fields', $errors );
    180200}
    181201
     
    209229                $errors = new WP_Error();
    210230        }
    211231
    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 default site signup variables.
     240         *
     241         * @since 3.0.0
     242         * @param array $signup_defaults An array of default site signup variables.
     243         */
     244        $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
    214245        $blogname = $filtered_results['blogname'];
    215246        $blog_title = $filtered_results['blog_title'];
    216247        $errors = $filtered_results['errors'];
     
    240271        <form id="setupform" method="post" action="wp-signup.php">
    241272                <input type="hidden" name="stage" value="gimmeanotherblog" />
    242273                <?php
    243                 /**
    244                  * Hidden signup form fields output for creating another site.
    245                  *
    246                  * @since MU
    247                  *
    248                  * @param string $context A string describing the step of the signup process. the value can be
    249                  *                        'create-another-site', 'validate-user', or 'validate-site'.
    250                  */
     274                //duplicate_hook
    251275                do_action( 'signup_hidden_fields', 'create-another-site' );
    252276                ?>
    253277                <?php show_blog_form($blogname, $blog_title, $errors); ?>
     
    281305        }
    282306
    283307        $public = (int) $_POST['blog_public'];
    284         $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated
     308
     309        $blog_meta_defaults = array(
     310                'lang_id' => 1,
     311                'public'  => $public
     312        );
     313
     314        /**
     315         * Filter the new blog meta variables.
     316         *
     317         * @since 3.0.0
     318         * @param array $blog_meta_defaults An array of default blog meta variables.
     319         */
     320        $meta = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); // deprecated
     321        /**
     322         * Filter the new blog meta after the signup_create_blog_meta hook.
     323         *
     324         * @since 3.0.0
     325         * @param array $meta An array of default blog meta variables.
     326         */
    285327        $meta = apply_filters( 'add_signup_meta', $meta );
    286328
    287329        wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     
    307349                <?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 ) ?>
    308350        </p>
    309351        <?php
     352        /**
     353         * Fires when sign up finished.
     354         *
     355         * @since 3.0.0
     356         */
    310357        do_action( 'signup_finished' );
    311358}
    312359
     
    329376
    330377        $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
    331378
    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 ));
     379        $signup_user_default = array(
     380                'user_name'  => $user_name,
     381                'user_email' => $user_email,
     382                'errors'         => $errors,
     383        );
     384
     385        /**
     386         * Filter defaut user variables.
     387         *
     388         * @since 3.0.0
     389         * @param array $signup_user_default An array of defaut user variables.
     390         */
     391        $filtered_results = apply_filters( 'signup_user_init', $signup_user_default );
    334392        $user_name = $filtered_results['user_name'];
    335393        $user_email = $filtered_results['user_email'];
    336394        $errors = $filtered_results['errors'];
     
    389447                return false;
    390448        }
    391449
    392         wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
     450        $optional_signup_meta = array();
    393451
     452        /**
     453         * Filter the optional sign up meta variables.
     454         *
     455         * @since 3.0.0
     456         * @param array $optional_signup_meta An array of optional signup meta variables.
     457         */
     458        $meta = apply_filters( 'add_signup_meta', $optional_signup_meta );
     459
     460        wpmu_signup_user($user_name, $user_email, $meta );
     461
    394462        confirm_user_signup($user_name, $user_email);
    395463        return true;
    396464}
     
    410478        <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
    411479        <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
    412480        <?php
     481        /**
     482         * Fires when sign up finished.
     483         *
     484         * @since 3.0.0
     485         */
    413486        do_action( 'signup_finished' );
    414487}
    415488
     
    430503        if ( !is_wp_error($errors) )
    431504                $errors = new WP_Error();
    432505
    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 ));
     506        $signup_blog_default = array(
     507                'user_name'  => $user_name,
     508                'user_email' => $user_email,
     509                'blogname'   => $blogname,
     510                'blog_title' => $blog_title,
     511                'errors'         => $errors
     512        );
     513
     514        /**
     515         * Filter default blog signup variables.
     516         *
     517         * @since 3.0.0
     518         * @param array $signup_blog_default An array of default blog signup variables.
     519         */
     520        $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_default );
    435521        $user_name = $filtered_results['user_name'];
    436522        $user_email = $filtered_results['user_email'];
    437523        $blogname = $filtered_results['blogname'];
     
    487573
    488574        $public = (int) $_POST['blog_public'];
    489575        $meta = array ('lang_id' => 1, 'public' => $public);
     576
     577        /**
     578         * Filter the new blog meta variables.
     579         *
     580         * @since 3.0.0
     581         * @param array $meta An array of default blog meta variables.
     582         */
    490583        $meta = apply_filters( 'add_signup_meta', $meta );
    491584
    492585        wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
     
    523616                </ul>
    524617        </p>
    525618        <?php
     619        /**
     620         * Fires when sign up finished.
     621         *
     622         * @since 3.0.0
     623         */
    526624        do_action( 'signup_finished' );
    527625}
    528626
    529627// Main
    530628$active_signup = get_site_option( 'registration', 'none' );
     629/**
     630 * Filter for sign up type. It should return "all", "none", "blog" or "user".
     631 *
     632 * @since 3.0.0
     633 * @param string $active_signup An string of sign up type.
     634 */
    531635$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
    532636
    533637// Make the signup type translatable.
     
    568672                case 'default':
    569673                default :
    570674                        $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
     675                        /**
     676                         * Fires when sign up form sent.
     677                         *
     678                         * @since 3.0.0
     679                         */
    571680                        do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere?
    572681                        if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    573682                                signup_another_blog($newblogname);
     
    592701?>
    593702</div>
    594703</div>
     704/**
     705 * Fires after sign up form before wp_footer action.
     706 *
     707 * @since 3.0.0
     708 */
    595709<?php do_action( 'after_signup_form' ); ?>
    596710
    597711<?php get_footer(); ?>