-
-
Save JulioPotier/2714688 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Password Reset Removed | |
* Description: Removes the ability for non admin users to change/reset their passwords. | |
* Version: 1.1 | |
* Author: Derek Herman ; Modified by Juliobox (boiteaweb.fr) | |
* Author URI: http://valendesigns.com | |
*/ | |
add_filter( 'show_password_fields', 'baw_prr_i_am_admin' ); | |
add_filter( 'allow_password_reset', 'baw_prr_i_am_admin' ); | |
add_filter( 'gettext', 'baw_prr_remove_me' ); | |
function baw_prr_i_am_admin() | |
{ | |
return is_admin() && current_user_can('administrator'); | |
} | |
function baw_prr_remove_me($text) | |
{ | |
return str_replace( array('Lost your password?', 'Lost your password'), '', trim($text, '?') ); | |
} | |
function baw_prr_no_password_change( $dummy1, $dummy2, $user ) | |
{ | |
if( !baw_prr_i_am_admin() ) | |
unset( $user->user_pass ); | |
} | |
add_action( 'user_profile_update_errors', 'baw_prr_no_password_change', 10, 3 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment