WordPress.org

Make WordPress Core

Ticket #25381: wp-signup.diff

File wp-signup.diff, 8.1 KB (added by miyauchi, 8 years ago)

inline docs for wp-signup.php

  • 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
     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 actions before sign up form on the sign up screen.
     73 *
     74 * @since 3.0
     75 */
    6676do_action( 'before_signup_form' );
    6777?>
    6878<div id="content" class="widecolumn">
     
    7989 */
    8090function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
    8191        global $current_site;
    82         // Blog name
     92        // Blog nam e
    8393        if ( !is_subdomain_install() )
    8494                echo '<label for="blogname">' . __('Site Name:') . '</label>';
    8595        else
     
    128138        </div>
    129139
    130140        <?php
     141    /**
     142     * Fires actions after sign up blog form.
     143     *
     144     * @since 3.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
     198     */
    179199        do_action( 'signup_extra_fields', $errors );
    180200}
    181201
     
    209229                $errors = new WP_Error();
    210230        }
    211231
    212         // allow definition of default variables
     232    /**
     233     * allow definition of default variables.
     234     *
     235     * @since 3.0
     236     * @param array $blogname, $blog_title, $errors
     237     */
    213238        $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
    214239        $blogname = $filtered_results['blogname'];
    215240        $blog_title = $filtered_results['blog_title'];
     
    239264        <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
    240265        <form id="setupform" method="post" action="wp-signup.php">
    241266                <input type="hidden" name="stage" value="gimmeanotherblog" />
     267        /**
     268         * Add extra hidden fields to the form of sign up another blog.
     269         *
     270         * @since 3.0
     271         */
    242272                <?php do_action( 'signup_hidden_fields' ); ?>
    243273                <?php show_blog_form($blogname, $blog_title, $errors); ?>
    244274                <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
     
    271301        }
    272302
    273303        $public = (int) $_POST['blog_public'];
     304    /**
     305     * Filter for the new blog meta.
     306     *
     307     * @since 3.0
     308     * @param array $blogname, $blog_title, $errors
     309     */
    274310        $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated
     311    /**
     312     * Filter for the new blog meta after the signup_create_blog_meta hook.
     313     *
     314     * @since 3.0
     315     * @param array $meta
     316     */
    275317        $meta = apply_filters( 'add_signup_meta', $meta );
    276318
    277319        wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     
    297339                <?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 ) ?>
    298340        </p>
    299341        <?php
     342    /**
     343     * Fires actions when sign up finished.
     344     *
     345     * @since 3.0
     346     */
    300347        do_action( 'signup_finished' );
    301348}
    302349
     
    319366
    320367        $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
    321368
    322         // allow definition of default variables
     369    /**
     370         * allow definition of default variables for sign up user
     371     *
     372     * @since 3.0
     373     * @param array $user_name, $user_email, $errors
     374     */
    323375        $filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
    324376        $user_name = $filtered_results['user_name'];
    325377        $user_email = $filtered_results['user_email'];
     
    330382        <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
    331383        <form id="setupform" method="post" action="wp-signup.php">
    332384                <input type="hidden" name="stage" value="validate-user-signup" />
     385        /**
     386         * Add extra hidden fields to the form of sign up another blog.
     387         *
     388         * @since 3.0
     389         */
    333390                <?php do_action( 'signup_hidden_fields' ); ?>
    334391                <?php show_user_form($user_name, $user_email, $errors); ?>
    335392
     
    376433                return false;
    377434        }
    378435
     436    /**
     437         * Allow definition of default for the meta variables for sign up user
     438     *
     439     * @since 3.0
     440     * @param array $user_name, $user_email, $errors
     441     */
    379442        wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
    380443
    381444        confirm_user_signup($user_name, $user_email);
     
    397460        <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
    398461        <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
    399462        <?php
     463    /**
     464     * Fires actions when sign up finished.
     465     *
     466     * @since 3.0
     467     */
    400468        do_action( 'signup_finished' );
    401469}
    402470
     
    417485        if ( !is_wp_error($errors) )
    418486                $errors = new WP_Error();
    419487
    420         // allow definition of default variables
     488    /**
     489         * Allow definition of default variablesi for the sign upped blog
     490     *
     491     * @since 3.0
     492     * @param array $user_name, $user_email, $blogname, $blog_title, $errors
     493     */
    421494        $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
    422495        $user_name = $filtered_results['user_name'];
    423496        $user_email = $filtered_results['user_email'];
     
    432505                <input type="hidden" name="stage" value="validate-blog-signup" />
    433506                <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
    434507                <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
     508        /**
     509         * Add extra hidden fields to the form of sign up another blog.
     510         *
     511         * @since 3.0
     512         */
    435513                <?php do_action( 'signup_hidden_fields' ); ?>
    436514                <?php show_blog_form($blogname, $blog_title, $errors); ?>
    437515                <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
     
    471549
    472550        $public = (int) $_POST['blog_public'];
    473551        $meta = array ('lang_id' => 1, 'public' => $public);
     552    /**
     553         * Allow definition of default variablesi for the sign upped blog
     554     *
     555     * @since 3.0
     556     * @param array $user_name, $user_email, $blogname, $blog_title, $errors
     557     */
    474558        $meta = apply_filters( 'add_signup_meta', $meta );
    475559
    476560        wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
     
    507591                </ul>
    508592        </p>
    509593        <?php
     594    /**
     595     * Fires actions when sign up finished.
     596     *
     597     * @since 3.0
     598     */
    510599        do_action( 'signup_finished' );
    511600}
    512601
    513602// Main
    514603$active_signup = get_site_option( 'registration', 'none' );
     604/**
     605 * Filter for sign up type. It should return "all", "none", "blog" or "user".
     606 *
     607 * @since 3.0
     608 * @param string $active_signup
     609 */
    515610$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
    516611
    517612// Make the signup type translatable.
     
    552647                case 'default':
    553648                default :
    554649                        $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
     650            /**
     651             * Fires actions when sign up form sent.
     652             *
     653             * @since 3.0
     654             */
    555655                        do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere?
    556656                        if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    557657                                signup_another_blog($newblogname);
     
    576676?>
    577677</div>
    578678</div>
     679/**
     680 * Fires actions after sign up form before wp_footer action.
     681 *
     682 * @since 3.0
     683 */
    579684<?php do_action( 'after_signup_form' ); ?>
    580685
    581686<?php get_footer(); ?>