Make WordPress Core

Changeset 25645


Ignore:
Timestamp:
09/28/2013 11:41:07 PM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-signup.php.

Props kpdesign, miyauchi.

Fixes #25381.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-signup.php

    r25616 r25645  
    1919 */
    2020function do_signup_header() {
     21    /**
     22     * Fires within the <head> section of the site sign-up screen.
     23     *
     24     * @since 3.0.0
     25     */
    2126    do_action( 'signup_header' );
    2227}
     
    6469get_header();
    6570
     71/**
     72 * Fires before the site sign-up form.
     73 *
     74 * @since 3.0.0
     75 */
    6676do_action( 'before_signup_form' );
    6777?>
     
    129139
    130140    <?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 );
    132149}
    133150
     
    177194        echo '<p class="error">' . $errmsg . '</p>';
    178195    }
     196    /**
     197     * Fires at the end of 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     */
    179203    do_action( 'signup_extra_fields', $errors );
    180204}
     
    210234    }
    211235
    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
    214257    $blogname = $filtered_results['blogname'];
    215258    $blog_title = $filtered_results['blog_title'];
     
    242285        <?php
    243286        /**
    244          * Hidden signup form fields output for creating another site.
     287         * Hidden sign-up form fields output when creating another site or user.
    245288         *
    246289         * @since MU
    247290         *
    248          * @param string $context A string describing the step of the signup process. the value can be
     291         * @param string $context A string describing the steps of the sign-up process. The value can be
    249292         *                        'create-another-site', 'validate-user', or 'validate-site'.
    250293         */
     
    282325
    283326    $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 search engines should be discouraged from indexing the site. 1 for true, 0 for false.
     352     * }
     353     */
    285354    $meta = apply_filters( 'add_signup_meta', $meta );
    286355
     
    308377    </p>
    309378    <?php
     379    /**
     380     * Fires when the site or user sign-up process is complete.
     381     *
     382     * @since 3.0.0
     383     */
    310384    do_action( 'signup_finished' );
    311385}
     
    330404    $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
    331405
    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 user 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 );
    334426    $user_name = $filtered_results['user_name'];
    335427    $user_email = $filtered_results['user_email'];
     
    390482    }
    391483
    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() ) );
    393486
    394487    confirm_user_signup($user_name, $user_email);
     
    411504    <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
    412505    <?php
     506    //duplicate_hook
    413507    do_action( 'signup_finished' );
    414508}
     
    431525        $errors = new WP_Error();
    432526
    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
    435552    $user_name = $filtered_results['user_name'];
    436553    $user_email = $filtered_results['user_email'];
     
    488605    $public = (int) $_POST['blog_public'];
    489606    $meta = array ('lang_id' => 1, 'public' => $public);
     607
     608    //duplicate_hook
    490609    $meta = apply_filters( 'add_signup_meta', $meta );
    491610
     
    524643    </p>
    525644    <?php
     645    //duplicate_hook
    526646    do_action( 'signup_finished' );
    527647}
     
    529649// Main
    530650$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 );
    532660
    533661// Make the signup type translatable.
     
    569697        default :
    570698            $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' );
    572705            if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    573706                signup_another_blog($newblogname);
     
    593726</div>
    594727</div>
    595 <?php do_action( 'after_signup_form' ); ?>
     728<?php
     729/**
     730 * Fires after the sign-up forms, before wp_footer.
     731 *
     732 * @since 3.0.0
     733 */
     734do_action( 'after_signup_form' ); ?>
    596735
    597736<?php get_footer(); ?>
Note: See TracChangeset for help on using the changeset viewer.