On a previous ticket you helped me block user access to the admin area, unless they were an admin.
I now realize that users will need access to the media library to view and upload new media. I tried having Access control the Media LIbrary, but that did not work. The Media Library pop up show but they can't do anything. See attached screen shot.
Is there are way to modify the origional code you provided to accomplish this?
Here is the code:
function func_no_admin_access() {
$redirect = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : home_url( '/' );
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if($user_role === 'exhibitor'){
exit( wp_redirect( $redirect ) );
}
}
add_action( 'admin_init', 'func_no_admin_access', 100 );
My issue is resolved now. Thank you!