WordPress.org

Make WordPress Core

Ticket #11172: 11172.002.diff

File 11172.002.diff, 2.5 KB (added by aaroncampbell, 8 years ago)

beaulebens patch with actions and filters

  • wp-includes/general-template.php

     
    197197}
    198198
    199199/**
     200 * Provides a simple login form, based on the wp-login.php form HTML. If the
     201 * current user is already logged in, returns nothing.
     202 *
     203 * @since x.x
     204 * @param string $redirect URL to redirect the user to on a successful login
     205 * @param bool $remember Include the "Remember Me" checkbox?
     206 * @return void
     207 */
     208function wp_login_form( $redirect = false, $remember = false ) {
     209        if ( is_user_logged_in() )
     210                return '';
     211
     212        if ( !$redirect )
     213                $redirect = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Default redirect is back to the current page
     214
     215        $redirect = apply_filters('login_form_redirect', $redirect);
     216        $remember = apply_filters('login_form_remember', $remember);
     217
     218        $form = '
     219                <form name="loginform" id="loginform" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post">
     220                        ' . do_action('login_form_top') . '
     221                        <p>
     222                                <label for="user_login">' . apply_filters( 'login_form_username', __( 'Username' ) ) . '</label>
     223                                <input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10" />
     224                        </p>
     225                        <p>
     226                                <label for="user_pass">' . apply_filters( 'login_form_password',  __( 'Password' ) ) . '</label>
     227                                <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" />
     228                        </p>
     229                        ' . do_action('login_form_middle') . '
     230                        ' . ( $remember ? '<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> ' . apply_filters( 'login_form_remember_me',  __( 'Remember Me' ) ) . '</label></p>' : '' ) . '
     231                        <p class="submit">
     232                                <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="' . apply_filters( 'login_form_log_in', __( 'Log In' ) ) . '" tabindex="100" />
     233                                <input type="hidden" name="redirect_to" value="' . esc_attr( $redirect ) . '" />
     234                        </p>
     235                        ' . do_action('login_form_bottom') . '
     236                </form>';
     237        return apply_filters('login_form', $form, $redirect, $remember) ;
     238}
     239
     240/**
    200241 * Returns the Lost Password URL.
    201242 *
    202243 * Returns the URL that allows the user to retrieve the lost password
     
    20462087        return apply_filters( "get_the_generator_{$type}", $gen, $type );
    20472088}
    20482089
    2049 ?>
    2050  No newline at end of file
     2090?>