Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › WordPress Posts Bulk Editor Professional not appearing in dashboard sidebar menu › Reply To: WordPress Posts Bulk Editor Professional not appearing in dashboard sidebar menu
19/03/2021 at 02:23
#7433
Vladimir
Keymaster
Update: as function can accept parameter $user_id, we have to check not current user only, but a user with ID equal $user_id value:
public static function can_manage_data($user_id = 0) {
if ($user_id === 0) {
$user = wp_get_current_user();
} else {
$user = get_userdata($user_id);
}
/*
if (in_array('administrator', $user->roles) OR in_array('editor', $user->roles)) {
return TRUE;
}
*/
if ( user_can( $user, 'edit_others_posts') ) {
return TRUE;
}
return FALSE;
}