• Resolved kendub62

    (@kendub62)


    Hi,

    When logging in using the Tutor LMS login page, I want the user to be redirected to a custom URL rather than the dashboard.

    I tried to use the “tutor_login_redirect_url” filter hook found in the documentation by adding the following snippet that I found here.

    function my_function($redirect_to) {
        $redirect_to = "https://mywebsite.com/custom-page/";
        return $redirect_to;
     }
    
     add_filter('tutor_login_redirect_url', 'my_function', 10, 1);

    However, this snippet doesn’t seem to do anything.

    I notice that the page that I found this snippet on is over two years old. Has this hook been replaced by a different hook in Tutor LMS 2.0?

    Note: I can’t use the more general wp_redirect function with the wp_login hook as this causes issues with Paid Memberships Pro.

    Thank you for your help! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • Dear @kendub62

    Please use this code to redirect the user to a specific URL after login.

    function redirect_on_login() {
    $some_url = ’https://google.com’;
    wp_redirect( $some_url );
    exit;
    }
    add_action( ‘wp_login’, ‘redirect_on_login’, 1 );

    Thank you

    Thread Starter kendub62

    (@kendub62)

    As I said in my original post, I can’t use the wp_redirect function with the wp_login hook as this causes issues when checking out with Paid Memberships Pro.

    Does the tutor_login_redirect_url hook not work anymore? It’s still in your documentation.

    Dear @kendub62

    tutor_login_redirect_url not working with other plugins like PMP.

    Thank you

    Thread Starter kendub62

    (@kendub62)

    In summary, this thread so far has gone as follows:

    Me: 1) I’m trying to do option A but it’s not working, can you help? Note: I can’t do option B.

    You: Have you tried option B?

    Me: I literally just said I can’t do option B.

    You: Option B does not work with option A.

    Me: What?!

    You’re doing the exact same thing that you did in this thread.

    Please read the following slowly… and carefully…

    I have added the following snippet on a fresh install of WordPress with Tutor LMS and Code Snippets being the only plugins installed.

    function my_function($redirect_to) {
        $redirect_to = "https://mywebsite.com/custom-page/";
        return $redirect_to;
     }
    
     add_filter('tutor_login_redirect_url', 'my_function', 10, 1);

    It doesn’t do anything.

    Question: Does this snippet still work in Tutor LMS 2.0?

    Dear @kendub62

    As I said before this code isn’t working the Tutor LMS
    function my_function($redirect_to) { $redirect_to = "https://mywebsite.com/custom-page/"; return $redirect_to; } add_filter('tutor_login_redirect_url', 'my_function', 10, 1);

    You need to add this code to your themes functions.php file
    function redirect_on_login() {
    $some_url = ’https://google.com’;
    wp_redirect( $some_url );
    exit;
    }
    add_action( ‘wp_login’, ‘redirect_on_login’, 1 );

    Thread Starter kendub62

    (@kendub62)

    “As I said before this code isn’t working the Tutor LMS”

    Please quote where you stated that that code does not work with Tutor LMS and I will gladly donate €500 to your chosen charity.

    “tutor_login_redirect_url not working with other plugins like PMP.”

    You are clearly implying with this statement that that code does work but is just incompatible with other plugins. You are contradicting your own statements.

    And please stop telling me to use the wp_redirect function when I told you in my first post that I cannot do that.

    Please answer the following question simply with a yes or a no as it’s impossible to understand any of your replies.

    Does the tutor_login_redirect_url hook still exist in Tutor LMS 2.0? Yes/no.

    Dear @kendub62

    Please check my last reply I told you that this hook will not work with the Tutor LMS tutor_login_redirect_url.

    Thank you

    Thread Starter kendub62

    (@kendub62)

    Yes, in your last reply, you stated “As I said before this code isn’t working the Tutor LMS”.

    However, that statement is a lie. You had never said that before. Not once.

    Why is the tutor_login_redirect_url hook still in your documentation if it no longer exists in Tutor LMS 2.0?

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