Make WordPress Core


Ignore:
Timestamp:
02/01/2021 10:11:46 PM (4 years ago)
Author:
adamsilverstein
Message:

Users: enable admins to send users a reset password link.

Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.

The feature appears in several places:

  • A "Send Reset Link" button on user profile screen.
  • A "Send password reset" option in the user list bulk action dropdown.
  • A "Send password reset" quick action when hovering over a username in the user list.

Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r49944 r50129  
    275275        }
    276276
     277        // Add a password reset link to the bulk actions dropdown.
     278        if ( current_user_can( 'edit_users' ) ) {
     279            $actions['resetpassword'] = __( 'Send password reset' );
     280        }
     281
    277282        return $actions;
    278283    }
     
    468473                    __( 'View' )
    469474                );
     475            }
     476
     477            // Add a link to send the user a reset password link by email.
     478            if ( get_current_user_id() !== $user_object->ID && current_user_can( 'edit_user', $user_object->ID ) ) {
     479                $actions['resetpassword'] = "<a class='resetpassword' href='" . wp_nonce_url( "users.php?action=resetpassword&amp;users=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Send password reset' ) . '</a>';
    470480            }
    471481
Note: See TracChangeset for help on using the changeset viewer.