[wp-trac] [WordPress Trac] #54481: User list doesn't honor allow_password_reset filter

WordPress Trac noreply at wordpress.org
Mon Nov 22 00:53:43 UTC 2021


#54481: User list doesn't honor allow_password_reset filter
--------------------------+------------------------------
 Reporter:  desmith       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Users         |     Version:  5.8.2
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, welcome back to WordPress Trac!

 Indeed, I think it makes for these links to be hidden if the
 `allow_password_reset` filter returns `false`.

 Just noting that there are several instances of these links:
 * `Send password reset` in the bulk actions dropdown.
 * `Send password reset` in action links.
 * `Send Reset Link` on Edit User screen.

 To make the check more reusable, perhaps this code from
 `get_password_reset_key()` should be separated into its own function, e.g.
 `is_password_reset_allowed()`:
 {{{
 $allow = true;
 if ( is_multisite() && is_user_spammy( $user ) ) {
         $allow = false;
 }

 /**
  * Filters whether to allow a password to be reset.
  *
  * @since 2.7.0
  *
  * @param bool $allow   Whether to allow the password to be reset. Default
 true.
  * @param int  $user_id The ID of the user attempting to reset a password.
  */
 $allow = apply_filters( 'allow_password_reset', $allow, $user->ID );
 }}}

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


More information about the wp-trac mailing list