Feature switch_to_user filter
-
Thank you for the plugin, it’s an excellent addition to the WordPress Community, especially for some of using WordPress as a platform.
For our own purposes we wanted some finer grain control around who can switch to who.
We made two customizations, one of which I’m lobbying you to put into the plugin.
1) Using a filter on user_has_cap – We were able to add the capabilities switch_to_user and switch_off for users with a different capability than edit_users.
2) Added the following filter to the switch_to_user function, right after the $old_user_id variable is defined. This is what seems like it would be a nice added feature for customizability.
`if($set_old_user){
$allowed = apply_filters(‘user_can_switch’, TRUE, $old_user_id, $user_id);
if(!$allowed){
return false;
}
}`We then hook into it and disallow users from switching to another user that is an Administrator.
Thanks!
- The topic ‘Feature switch_to_user filter’ is closed to new replies.