Okay
  Public Ticket #3608859
account redirection
Closed

Comments

  • Jose started the conversation

    hello, I am looking for a solution with your plugin so that a user when connecting is redirected to a specific page.
    that is to say a client, who is called "Paris" from the B2B group, is automatically redirected when connecting to a "mysite/Paris" page.
    and that another client, named "London" from the B2B group, is automatically redirected when connecting to the "mysite/London" page

    thank you team

  •  1,881
    WebWizards replied

    Hello Jose,

    Thank you for purchasing our plugin,


    Here are you specifically referring to only the login? or also the initial registration redirect?


    B2BKing does not have direct features for this, but we can assist with a code snippet to achieve this. For example, here is a code snippet that redirects the users with usernames 'Paris' and 'London' during login:

    add_filter( 'woocommerce_login_redirect', 'custom_login_redirect', 10, 2 );
    function custom_login_redirect( $redirect, $user ) {
        if ( $user->user_login == 'Paris' ) {
            $redirect = 'page1';
        } else if ( $user->user_login == 'London' ) {
            $redirect = 'page2';
        }
        return $redirect;
    }
    

    We can modify this snippet to add more users, or we could modify it to do this based on a user group (so for example you can always redirect group X to page 1, and always redirect group Y to page 2 on login).


    Let me know your thoughts on that,


    Kind regards,

    Stefan