• Resolved gradient9

    (@gradient9)


    Hello,

    I’m trying to redirect a specific user to a page in the WP dashboard but it is being overwritten by the customer area plugin. Is there any way to disable the redirect or modify it for a specific user or user group? I’m using Peter’s Login Redirect to accomplish the redirect. Is there anyway to have Peter’s Login Redirect overwrite the CA redirection?

    Thank you

    https://www.ads-software.com/plugins/customer-area/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Vincent Mimoun-Prat

    (@vprat)

    Hi,

    In which cases precisely doesn’t it work as you would like?

    Thread Starter gradient9

    (@gradient9)

    Hello,

    When I login with the specific user, they are automatically redirected to the Customer Area Dashboard page rather than redirecting to the link I’ve set up in Peter’s redirect login. When I deactivate the CA plugin, the redirect works as planned for that user.

    Is there any way to modify the CA plugin’s redirect after login? With Peter’s redirect login plugin, I can choose a setting that will check a particular file first and then proceed with the other redirects. I just need to know where to look to adjust the code in the CA plugin.

    Thank you

    Plugin Contributor Vincent Mimoun-Prat

    (@vprat)

    This happens in the plugin.class.php file, in function login_then_redirect_to_url

    I think without touching the plugin, this could work:

    add_filter('cuar/routing/login-url', 'cuar_disable_login_redirect');
    function cuar_disable_login_redirect($original_url) {
      return '';
    }

    Also note that we have a specific add-on to handle login forms nicely, maybe this would work for you too.

    Thread Starter gradient9

    (@gradient9)

    I have the login form add-on already. I do like it and it works well, thank you.

    I inserted the code above into the functions.php file but it is still redirecting to the CA dashboard page rather than what I’ve set up. Any other recommendations?

    Plugin Contributor Vincent Mimoun-Prat

    (@vprat)

    I see, this is not working because the login forms add-on is installed.

    Currently there is no filter to disable redirection with the login forms add-on.

    Temporarly, you can edit the login forms’ add-on file “customer-login-addon.class.php” and comment the line:

    wp_redirect( !empty( $redirect ) ? $redirect : home_url(), 302);

    Let me know if that is better

    Thread Starter gradient9

    (@gradient9)

    Removed the line from functions.php and commented out the line within the login add-on but it still is not redirecting as intended. Any other ideas?

    Plugin Contributor Vincent Mimoun-Prat

    (@vprat)

    I had a quick look at Peter’s plugin and this may work:

    edit the login forms’ add-on file “customer-login-addon.class.php” and replace the line:

    wp_redirect( !empty( $redirect ) ? $redirect : home_url(), 302);

    by

    $redirect_to = !empty( $redirect ) ? $redirect : home_url();
    $user = wp_get_current_user();
    wp_redirect(apply_filters('login_redirect', $redirect_to, $redirect_to, $user), 302);
    Thread Starter gradient9

    (@gradient9)

    That worked! Thank you so much for your prompt responses and help!

    Plugin Contributor Vincent Mimoun-Prat

    (@vprat)

    I will include this fix in the next release.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Redirect’ is closed to new replies.