Thank you for reporting this.
Are you using any other plugins to manage memberships, restrict access, or redirect logins?
Specifically, can you provide some more details about how you are doing this:
we’ve hidden the WordPress dashboard from members.
E.g. are you using the “Deny Access to Admin Area” option for one or more of your Access Levels?
Hello, thanks for your reply!
We are not using any additional plugin for restricting access to the dashboard. Only the option within the Restrict User Access plugin under Options >> Deny Access to Admin Area
Looking forward to hearing your thoughts!
Hello! Is there any update on this? Thanks so much!
Apologies for the delayed response here. I was able to reproduce the problem you are experiencing, and I will include a fix for it in the next version.
In the meantime, adding this to your theme’s functions.php should stop redirecting users to the admin area if they don’t have access to it:
add_filter( 'login_redirect', function($redirect_to, $requested_redirect_to, $user ) {
$intercept = empty($redirect_to) || mb_strpos($redirect_to, 'wp-admin') !== false;
if(!$intercept) {
return $redirect_to;
}
if(!function_exists('rua_get_user')) {
return $redirect_to;
}
$rua_user = rua_get_user($user);
if ($rua_user->has_global_access()) {
return $redirect_to;
}
$user_levels = $rua_user->get_level_ids();
if (empty($user_levels)) {
return $redirect_to;
}
$metadata = RUA_App::instance()->level_manager->metadata()->get('admin_access');
foreach ($user_levels as $level_id) {
if ($metadata->get_data($level_id, true)) {
return $redirect_to;
}
}
return home_url();
}, 10, 3);
Thank you very much for this!
Hello, I’ve added the code to the site but am still directed to the domain.com/wp-admin/profile.php which gives this “Sorry, you are not allowed to access this page.” error because I’m a subscriber. Is there a way to redirect this page to the /login URL?
Hello, can you please advise on what we can do for this? And if this has been added to the plugin update?