Making WordPress.org

Changeset 11379


Ignore:
Timestamp:
12/16/2021 03:29:41 AM (3 years ago)
Author:
dd32
Message:

Login: Replace the call to wp_login_form() with a static form so that we can customise the content.

wp_login_form() isn't the same as wp-login.php and isn't as easy to customise; By removing it we'll be able to add things that wp-login.php has such as a show password button.

See #5850.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php

    r11378 r11379  
    464464}
    465465
    466 // This is the action in the top of `wp_login_form()`, which is not used on wp-login.php, see below.
    467 function wporg_login_form_top( $message ) {
    468     $message .= '<p class="intro">' . wporg_login_wporg_is_starpress() . '</p>';
    469 
    470     return $message;
    471 }
    472 add_filter( 'login_form_top', 'wporg_login_form_top' );
    473 
    474466// This is the login messages, which is displayed on wp-login.php, which does not use wp_login_form() or it's actions.
    475467function wporg_login_errors_message( $errors, $redirect_to ) {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/login.php

    r11046 r11379  
    77
    88get_header();
     9
     10// Prefill the username if possible.
     11$username = $_REQUEST['user'] ?? ( wp_parse_auth_cookie()['username'] ?? '' );
     12
     13// Redirect is validated at redirect time, just pass through whatever we can.
     14if ( !empty( $_REQUEST['redirect_to'] ) ) {
     15    $redirect = wp_unslash( $_REQUEST['redirect_to'] );
     16} elseif ( $referer = wp_get_referer() ) {
     17    $redirect = $referer;
     18} else {
     19    $redirect = 'https://profiles.wordpress.org/';
     20}
    921?>
    1022
    11 <?php
    12 wp_login_form( [
    13     // pre-fill with a given username, or with the last user if their session has simply timed out.
    14     'value_username' => $_REQUEST['user'] ?? ( wp_parse_auth_cookie()['username'] ?? '' )
    15 ] );
    16 ?>
     23<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
     24    <p class="intro"><?php echo wporg_login_wporg_is_starpress(); ?></p>
     25    <p class="login-username">
     26        <label for="user_login"><?php _e( 'Username or Email Address', 'wporg-login' ); ?></label>
     27        <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr( $username ); ?>" size="20" />
     28    </p>
     29    <p class="login-password">
     30        <label for="user_pass"><?php _e( 'Password', 'wporg-login' ); ?></label>
     31        <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" />
     32    </p>
     33    <p class="login-remember"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e( 'Remember Me', 'wporg-login' ); ?></label></p>
     34    <p class="login-submit">
     35        <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary" value="<?php esc_attr_e( 'Log In', 'wporg-login' ); ?>" />
     36        <input type="hidden" name="redirect_to" value="<?php echo esc_url( $redirect ); ?>" />
     37    </p>
     38</form>
    1739
    1840<p id="nav">
Note: See TracChangeset for help on using the changeset viewer.