This is a plugin for WordPress Multisite 3.0+ that restricts password changes and password resets to super admins only. This is handy when user creation and authentication are handled from an external application and passwords should only be changed on one system.
Download from WordPress.org or add this code to a file named restrict_password_changes.php and upload it to wp-content/mu-plugins.
/*
Plugin Name: Restrict Password Changes - MultiSite
Plugin URI: http://www.totallyryan.com/projects
Description: This is a plugin for WordPress Multisite 3.0+ that restricts password changes and password resets to super admins only. This is handy when user creation and authentication are handled from an external application and passwords should only be changed on one system.
Author: Ryan Willis
Version: 0.1
Author URI: http://www.totallyryan.com
*/
function tr_restrict_password_changes_prevent() {
if(!is_super_admin()) {
$_POST['pass1'] = '';
$_POST['pass2'] = '';
}
}
function tr_restrict_password_changes($val = null) {
if(is_multisite()) {
if(is_super_admin()) return true;
else return false;
} else {
return true;
}
}
function tr_restrict_password_reset() {
return false;
}
function tr_remove_reset_link_init() {
add_filter('gettext', 'tr_remove_reset_link');
}
function tr_remove_reset_link($text) {
if(strpos($text, 'Lost your password') !== false) $text = str_replace('Lost your password', '', str_replace('Lost your password?', '', str_replace('Lost your password?', '', $text)));
return $text;
}
add_filter('show_password_fields', 'tr_restrict_password_changes');
add_action('edit_user_profile_update', 'tr_restrict_password_changes_prevent');
add_action('personal_options_update', 'tr_restrict_password_changes_prevent');
add_filter('allow_password_reset', 'tr_restrict_password_reset');
add_action('login_head', 'tr_remove_reset_link_init');
add_filter('login_errors', 'tr_remove_reset_link');