• Resolved sasha49

    (@sasha49)


    Hello,

    We have the restrict user plugin on our site, and when members want to reset their password they go through the normal steps of sending a link to their email, resetting the password but once they’ve completed these steps it redirects them to this URL: /wp-login.php?action=resetpass which is restricted because members are subscribers and we’ve hidden the WordPress dashboard from members. The members on this site are get confused because it appears as if they don’t have access to the website itself when they would just need to navigate to the root domain. Is there a way to redirect this to the dashboard after they reset their passwords? Or even to the homepage?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    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?

    Thread Starter sasha49

    (@sasha49)

    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!

    Thread Starter sasha49

    (@sasha49)

    Hello! Is there any update on this? Thanks so much!

    Plugin Author Joachim Jensen

    (@intoxstudio)

    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);
    Thread Starter sasha49

    (@sasha49)

    Thank you very much for this!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.