0

I want to create custom role ('sales') that can edit user profiles of 'subscribers' but can not change the role of that user.

The user details that would be editable by the 'sales' role would be resetting password and interacting with some custom user-meta fields.

Is it possible to edit capabilities at that level of granularity?

0

I am not sure if there is something native. However you could get really hacky if you wanted to if no other option.

You could create a css class to be inserted based on the current user role that is logged in. Then target that role (being sales for example) and hide that form field.

You could use something like this:

function sales_role_admin_body_class( $classes ) {
    global $current_user;
    foreach( $current_user->roles as $role )
        $classes .= ' role-' . $role;
    return trim( $classes );
}
add_filter( 'admin_body_class', 'sales_role_admin_body_class' );

Then you could target it something like this in your css:

.role-sales #form_field_id_you_want_to_hide{ 
    display: none !important; 
}

Purely an example and very hacky. However it would work if no other option.

| improve this answer | |

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.