0

I want to disable changing password option for all my subscriber users.

Is it possible by doing any code tweak or something using any plugin?

Disable password changing option for subscriber users

If someone has any idea or plugin knowledge to do this then appreciated.

2

You can try

if( current_user_can( 'subscriber' ) ) {
    add_filter( 'show_password_fields', '__return_false' );
}

see also http://wpengineer.com/2285/disable-password-fields-for-non-admins/

http://adambrown.info/p/wp_hooks/hook/show_password_fields

  • where do i put this code? in any theme specific file? In functions.php right. – Frank Apr 8 '13 at 8:02
  • Yes, here (and in most case when you need to add code), it's likely to be in functions.php. Never tweak core files, unless you knwo what you're doing. – Overdose Apr 8 '13 at 8:24
1

If you want to hide the passwords fields on the profile page, you can use the show_password_fields filter

add_filter('show_password_fields','hide_password_wpse_94968');
function hide_password_wpse_94968() {
    if(!current_user_can('edit_posts')){
        // hide only for subscribers
        return false;
    }
    return true; // for all other users that can edit posts
}

where we hide it for all users that can't edit posts (subscribers).

The subscribers will still be able to retrieve new passwords via wp-login.php?action=lostpassword.


Before hiding the passwords fields:

Before hiding


After hiding the passwords fields:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.