login redirect to current page
-
hey , this is amazing plugin !
can u help me how to redirect to current page after use social login?
i’ve choose Login redirection->Same page where user logged in.
but it not work for me.And also have a question , how can i let social login get faster while login or signup, it need redirect long time to turn to page.
-
This topic was modified 1 year, 3 months ago by
power1parts.
The page I need help with: [log in to see the link]
-
This topic was modified 1 year, 3 months ago by
-
btw i’ve setting login redirect php code . i dont know will that crash the plugin function?
add_filter( 'woocommerce_get_price_html', 'bbloomer_hide_price_addcart_not_logged_in', 9999, 2 ); function bbloomer_hide_price_addcart_not_logged_in( $price, $product ) { if ( ! is_user_logged_in() ) { $current_url = remove_query_arg( 'redirect_to' ); // 移除現有的 redirect_to 參數 $login_url = add_query_arg( 'redirect_to', urlencode( $current_url ), get_permalink( wc_get_page_id( 'myaccount' ) ) ); $price = '<div><a href="' . $login_url . '">' . __( 'Login to see prices', 'bbloomer' ) . '</a></div>'; remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); add_filter( 'woocommerce_is_purchasable', '__return_false' ); } return $price; }
Hey,
Thanks for the appreciation 🙂
I cannot find the social login buttons at the link you have posted. Please note that if you use social login from the Login, Register pages of your website, you will be redirected to the page which is there in the redirect_to querystring parameter in the URL in the address bar OR to the homepage, if this parameter is not there because there is no point in showing the login, register pages to the user who has already logged into your website.
No, your code will not cause trouble.-
This reply was modified 1 year, 3 months ago by
Heateor Support.
can u check the pic? u can clink that link turn to login page. but if i use line or google to login,it will trun to homepage , but if i use wordpress login it will turn to current page .
I saw you testing on my website, please let me know if there is any progress.
Thanks!!!Try adding following code in the functions.php file of the active theme of your website. It should redirect to the desired URL.
/**
* Redirect user to the URL mentioned in the redirect_to querystring
* parameter after social login
*/
function heateor_ss_custom_redirection( $redirectionUrl, $theChampLoginOptions, $user_ID, $twitterRedirect, $register ) {
if ( isset( $_GET['redirect_to'] ) ) {
return urldecode( $_GET['redirect_to'] );
}
return $redirectionUrl;
}
add_filter( 'heateor_ss_login_redirection_url_filter', 'heateor_ss_custom_redirection', 10, 5 );Let me know how it goes.
Sorry it isnt work, when i click that i provide link and use line and google ,i think it trun to 404, but i redirect 404 to homepage,so it turn me to another url.
that is i use google to login and its url
and when i use google login
it will take me to
https://accounts.google.com.tw/accounts/SetSID
then go to myhomepageAs you are using LiteSpeed Cache plugin, you need to clear website cache after pasting the code posted above and before trying the social login.
YES, i did clear cache. its not redirect to current page either.
Okay, replace previous code with the following and check if it works.
/**
* Redirect user to the URL mentioned in the redirect_to querystring
* parameter after social login
*/
function heateor_ss_custom_redirection( $redirectionUrl, $theChampLoginOptions, $user_ID, $twitterRedirect, $register ) {
if ( isset( $_GET['redirect_to'] ) && function_exists( 'heateor_ss_validate_url' ) && heateor_ss_validate_url( urldecode( $_GET['redirect_to'] ) ) === false ) {
return home_url() . urldecode( $_GET['redirect_to'] );
}
return $redirectionUrl;
}
add_filter( 'heateor_ss_login_redirection_url_filter', 'heateor_ss_custom_redirection', 10, 5 );No ,its not worked. its turn to homepage too.
-
This reply was modified 1 year, 3 months ago by
power1parts.
but when i choose Custom Url option of Login redirection , it works, only the “Same page where user logged in” is not work.
Did you clear website cache after replacing the code? If yes, shoot an email to support[at]heateor[dot]com so that I could assist you further.
OK, i’ve a;ready send to ur email.
The URL in the redirect_to parameter at the page is not a full URL (missing the domain part) and thus when the plugin is validating it before redirecting the logged in user, it’s not returning to be a valid URL. You would like to contact your theme dev about this and ask them if they can take care of it in the next update.
-
This reply was modified 1 year, 3 months ago by
- The topic ‘login redirect to current page’ is closed to new replies.