Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#59983 closed defect (bug) (fixed)

wp-login.php: login messages/errors

Reported by: mapumba Owned by: SergeyBiryukov
Priority: normal Milestone: 6.4.3
Component: Login and Registration Version: 6.4
Severity: normal Keywords: fixed-major dev-reviewed
Cc: Focuses:

Description

When using the following code:

<?php
add_filter( 'wp_login_errors', function( $errors ) {

    $errors->add(
                'test_error',
                'Error Test'
        );

        $errors->add(
                'test_message',
                'Message Test',
                'message' // This is not an error..
        );

        return $errors;
}, 10 );

It only shows the "Message Test". This is because the variable "$error_message" in wp-login.php is used to display the message if there is only one error. But in this example the variable contains the Text of the Message and not the Error Message.

Attachments (3)

wp-login.patch​ (494 bytes ) - added by mapumba 3 years ago.
with_trunk.png​ (16.0 KB ) - added by mapumba 3 years ago.
with_patch.png​ (15.5 KB ) - added by mapumba 3 years ago.

Download all attachments as: .zip

Change History (11)

@mapumba
3 years ago

@mapumba
3 years ago

@mapumba
3 years ago

#1 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review → 6.4.2

#2 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 57142:

Login and Registration: Use correct variable to display a single error message.

When the wp_login_errors filter is used to add an error message followed by an instructional message, the former was not displayed and the latter was errouneously displayed twice above the login form.

This commit ensures that the error message is displayed as expected.

Follow-up to [56654].

Props mapumba.
Fixes #59983.

#3 @SergeyBiryukov
3 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closed → reopened

Hi there, welcome to WordPress Trac! Thanks for the patch.

Reopening for backporting to the 6.4 branch.

#4 @jorbin
3 years ago

  • Keywords dev-reviewed added

[57142] looks good for 6.4 branch

#5 @SergeyBiryukov
3 years ago

  • Milestone 6.4.2 → 6.4.3

#6 @SergeyBiryukov
3 years ago

  • Version trunk → 6.4

This ticket was mentioned in ​Slack in #core by jorbin. ​View the logs.


3 years ago

#8 @peterwilsoncc
3 years ago

  • Resolution → fixed
  • Status reopened → closed

In 57288:

Login and Registration: Use correct variable to display a single error message.

When the wp_login_errors filter is used to add an error message followed by an instructional message, the former was not displayed and the latter was errouneously displayed twice above the login form.

This commit ensures that the error message is displayed as expected.

Follow-up to [56654].

Reviewed by jorbin.
Merges [57142] to the 6.4 branch.

Props mapumba, SergeyBiryukov.
Fixes #59983.

Note: See TracTickets for help on using tickets.