Public Ticket #3516872

Redirect user after completed the form registration

Closed
Comments
8 Tickets 4
Mar started the conversation 3 years ago on November 7, 2023 at 2:30pm

Hello!

In my store, B2B users require manual approval when completing the registration form. After submitting the registration form, I need to redirect the user to a landing page where they will receive information stating that their account is pending validation. They will also be notified by email once their account is approved.

How can I set up this redirection for the B2B registration form submission?I haven't found this solution in the documentation.

I'm awaiting your answer, ASAP.
Best regards!

2,762
KingsPlugins replied 3 years ago on November 22, 2023 at 8:01pm

Hi there,

I believe that that redirect code is causing a conflict. Here is the problem: when B2BKing registers a manual approval user, WooCommerce automatically logs in the user (Standard functionality) - B2BKing must log out the user as we don't want them to be logged in until approval. When B2BKing logs out the user, your redirect code is triggered.



Please try to change the code to this one:

add_action('wp_logout','owp_redirect_after_logout', 10, 1);
function owp_redirect_after_logout($user_id){
    $user_approval = get_user_meta($user_id, 'b2bking_account_approved', true);
    if ($user_approval !== 'no'){
        wp_redirect('https://blisscare-lab.com/');
        exit();
    }
}

I think that can resolve it.


Kind regards,

Stefan


2,762
KingsPlugins replied 3 years ago on November 23, 2023 at 11:05pm

Hi there,

My understanding is that the error says you already have the other logout snippet active and it cannot redeclare the function.

1550177412.png

You must deactivate the other code snippet with the logout redirect - both should not be active at the same time.

Sign In