Skip to content

trepmal.com

  • Home
  • Plugins
  • Github
  • Me on WP.org
  • Donate

Categories

  • WordPress Bits (149)
  • Uncategorized (11)
  • Scripts (5)
  • Tidbits (5)
  • Fun (3)

Tags

  • wordpress (30)
  • administration (16)
  • plugin (9)
  • free download (8)
  • functions.php (8)

Year

  • 2018 (8)
  • 2016 (2)
  • 2015 (4)
  • 2014 (19)
  • 2013 (11)

Tag: login

Disallow Password Resets

The reasons may vary, but if you need to prevent users from resetting their own passwords via the “Lost your password?” link, add this:

add_filter('allow_password_reset', '__return_false' );

Alternatively, if you only want to stop certain users from resetting their passwords, do this:

add_filter('allow_password_reset', 'no_reset', 10, 2 );
function no_reset( $bool, $user_id ) {
    $ids = array( 3, 10 ); //IDs of users who are not allowed to reset their password
    if ( in_array( $user_id, $ids ) )
        return false;

    return true;
}
Posted on July 28, 2011March 1, 2012Categories WordPress BitsTags login, passwordsLeave a comment on Disallow Password Resets
Proudly powered by WordPress