Make WordPress Core

#59983 closed defect (bug) (fixed)

wp-login.php: login messages/errors

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

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 15 months ago.
with_trunk.png (16.0 KB) - added by mapumba 15 months ago.
with_patch.png (15.5 KB) - added by mapumba 15 months ago.

Download all attachments as: .zip

Change History (11)

@mapumba
15 months ago

@mapumba
15 months ago

@mapumba
15 months ago

#1 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 6.4.2

#2 @SergeyBiryukov
15 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to 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
15 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

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

Reopening for backporting to the 6.4 branch.

#4 @jorbin
14 months ago

  • Keywords dev-reviewed added

[57142] looks good for 6.4 branch

#5 @SergeyBiryukov
14 months ago

  • Milestone changed from 6.4.2 to 6.4.3

#6 @SergeyBiryukov
14 months ago

  • Version changed from trunk to 6.4

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


14 months ago

#8 @peterwilsoncc
13 months ago

  • Resolution set to fixed
  • Status changed from reopened to 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.