Passing ?lang=fr to Custom Redirect URL
-
Hello,
I have implemented Ultimate Member on my WordPress site along with WPML, with default language as English and secondary language as French, and 2 user selectable roles. I have created both EN and FR registration forms (independently as they vary slightly), and I am using shortcodes to display the necessary form for each language. Everything works fine leading up to and including the form, but whenever I submit the form, the user is sent to the Custom Redirect URL but without the ?lang=fr tag so the French users see the English confirmation page. To complicate matters, there are 2 roles and each has it’s own Custom Redirect URL.
I have tried using code found elsewhere, as posted below. While this gets me closer, I need the URL to be that of whatever role the user has selected, so it can’t be a static URL as it is in the attached code.
Is there a variable available for the Custom Redirect URL available and how can I append the “/?lang=fr” to it? Or is there another way to accomplish what I am after?
Thank you for your time.
Glen
—
add_action( ‘um_registration_after_auto_login’, ‘custom_register_redirect_secondary_language’ );
function custom_register_redirect_secondary_language( $user_id ) {if( ! function_exists( ‘um_user’ ) )
return;$url_redirect_register = um_user( ‘auto_approve_url’ );
// check the it’s secondary language
if( ICL_LANGUAGE_CODE == ‘en’ ) {
// use custom URL to do the redirect
$url_redirect_register = ‘https://site.com/en/custom-url-secondary-language/’;
}exit( wp_redirect( $url_redirect_register ) );
}The page I need help with: [log in to see the link]
- The topic ‘Passing ?lang=fr to Custom Redirect URL’ is closed to new replies.