WordPress.org

Make WordPress Core

Ticket #31821: 31821.2.patch

File 31821.2.patch, 2.5 KB (added by jfarthing84, 5 years ago)

Add interim_login parameter to wp_login_url().

  • wp-includes/general-template.php

     
    331331 *
    332332 * @param string $redirect Path to redirect to on login.
    333333 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
     334 * @param bool $interim_login Whether this is an interim login or not. Default is false.
    334335 * @return string A log in URL.
    335336 */
    336 function wp_login_url($redirect = '', $force_reauth = false) {
     337function wp_login_url($redirect = '', $force_reauth = false, $interim_login = false) {
    337338        $login_url = site_url('wp-login.php', 'login');
    338339
    339340        if ( !empty($redirect) )
     
    342343        if ( $force_reauth )
    343344                $login_url = add_query_arg('reauth', '1', $login_url);
    344345
     346        if ( $interim_login )
     347                $login_url = add_query_arg( 'interim-login', '1', $login_url );
     348
    345349        /**
    346350         * Filter the login URL.
    347351         *
     
    348352         * @since 2.8.0
    349353         * @since 4.2.0 The `$force_reauth` parameter was added.
    350354         *
    351          * @param string $login_url    The login URL.
    352          * @param string $redirect     The path to redirect to on login, if supplied.
    353          * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
     355         * @param string $login_url     The login URL.
     356         * @param string $redirect      The path to redirect to on login, if supplied.
     357         * @param bool   $force_reauth  Whether to force reauthorization, even if a cookie is present.
     358         * @param bool   $interim_login Whether this is an interim login or not.
    354359         */
    355         return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
     360        return apply_filters( 'login_url', $login_url, $redirect, $force_reauth, $interim_login );
    356361}
    357362
    358363/**
  • wp-includes/functions.php

     
    46454645 * @since 3.6.0
    46464646 */
    46474647function wp_auth_check_html() {
    4648         $login_url = wp_login_url();
     4648        $login_url = wp_login_url( '', false, true );
    46494649        $current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
    46504650        $same_domain = ( strpos( $login_url, $current_domain ) === 0 );
    46514651
     
    46684668
    46694669        if ( $same_domain ) {
    46704670                ?>
    4671                 <div id="wp-auth-check-form" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
     4671                <div id="wp-auth-check-form" data-src="<?php echo esc_url( $login_url ); ?>"></div>
    46724672                <?php
    46734673        }
    46744674