[wp-trac] [WordPress Trac] #58407: resetpassword action on users.php (users list page) handles retrieve_password() return incorrectly

WordPress Trac noreply at wordpress.org
Fri May 26 05:05:57 UTC 2023


#58407: resetpassword action on users.php (users list page) handles
retrieve_password() return incorrectly
-------------------------------------------------+-------------------------
 Reporter:  letraceursnork                       |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.3
Component:  Users                                |     Version:  6.2.2
 Severity:  trivial                              |  Resolution:
 Keywords:  good-first-bug has-patch needs-      |     Focuses:  ui,
  refresh                                        |  administration
-------------------------------------------------+-------------------------
Changes (by dilipbheda):

 * keywords:  good-first-bug has-patch => good-first-bug has-patch needs-
     refresh


Comment:

 Hey @prashantbhivsane

 I believe it should be good if we display an error notice instead of a
 success notice.

 Need the below changes in the wp-admin/users.php file.


 {{{
 case 'resetpassword':
         $reset_count = isset( $_GET['reset_count'] ) ? (int)
 $_GET['reset_count'] : 0;
         $notice_type = 'updated';
         if ( 1 === $reset_count ) {
                 $message = __( 'Password reset link sent.' );
         } else {
                 /* translators: %s: Number of users. */
                 $message     = _n( 'Password reset links sent to %s
 user.', 'Password reset links sent to %s users.', $reset_count );
                 $notice_type = 'error';
         }
         $messages[] = '<div id="message" class="notice is-dismissible ' .
 esc_attr( $notice_type ) . '"><p>' . sprintf( $message,
 number_format_i18n( $reset_count ) ) . '</p></div>';
         break;
 }}}


 Before: https://tinyurl.com/2fjpsasl
 After apply changes: https://tinyurl.com/2ps5c4y7

 CC @SergeyBiryukov

 Thanks

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58407#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list