-
Author
-
September 23, 2017 at 02:18 #174448psmorrowParticipant
Hi there,
I’m experiencing an issue that my login redirect code isn’t working on my site, but works just fine on localhost where i do my development.
The only differences are my site has SSL and W3 Total Cache, which are not installed/configured on Localhost. Everything else is the same. I also have a ton of other custom code, which seems to work just fine.
function redirect_page( $redirect_to, $request, $user ) {
$user_id = $user->ID;
//redirect to profile page
$redirect_to = bp_core_get_user_domain($user->ID) . ‘profile/’;
return $redirect_to;
}
add_filter(‘login_redirect’, ‘redirect_page’, 11, 3);
Any thoughts about why could be happening? Is it a caching issue?
September 23, 2017 at 19:56 #174538Kieran_SQModeratorHi,
I will assign this ticket to one of our developers to look into this for you.
In the meantime please try disabling and clearing all caches as well as checking your PHP error log for hints. Please also consider this superb plugin which will do many kinds of different redirects for you https://wordpress.org/plugins/peters-login-redirect/.
Thanks,
Kieran
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionIf you like the theme or the support you've received please consider leaving us a review on Themeforest!
Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.
September 25, 2017 at 17:05 #174736RaduModeratorHi,
The snippet that you are using looks good. I’m using the next code in kleo child theme and iti works as it should.
COPY CODEfunction sq7_rdu_redirect( $redirect_to, $request, $user ) { $redirect_to = bp_core_get_user_domain($user->ID) . 'profile/'; return $redirect_to; } add_filter('login_redirect', 'sq7_rdu_redirect', 11, 3);
And also this
COPY CODEfunction sq7_rdu_redirect( $redirect_to, $request, $user ) { $redirect_to = '/my-route-after-redirect/'; return $redirect_to; } add_filter('login_redirect', 'sq7_rdu_redirect', 11, 3);
try to change the 11 value to a higher or lower one… try also to remove all other your snippets and leave only this to test
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 26, 2017 at 21:00 #174883psmorrowParticipantHi,
Thanks for the reply. Sorry to say that I didn’t have any luck with:– increasing / decreasing priority (tried many different numbers from 0 to 999)
– removed bp-custom.php from pluglins
– removed all other code from functions.php
– deactivated all plugins except for buddypress
– cleared all cache, and disabled W3 Total CacheI have also verified that no errors are being logged in error_log….
Any other suggestions on what else I can try?
I’ll also experiment with Peters-login-redirect….
Many thanks again for your help with this!
September 27, 2017 at 16:35 #174960RaduModeratorThat’s odd…
Leave the w3 total cache de-activated while debugging, also de-activate object cache etc…
I don’t know what can I advise you since those snippets work on my and on your side not…
Try with peters redirect plugin instead.
If you have cloudflare or something similar de-activate it while debugging (enable developer mode)
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 28, 2017 at 00:35 #175037psmorrowParticipantAlso note, that this snippet doesn’t work either? Any connection you can think of?
COPY CODEfunction action_bb_user_login ( $user_id ){ $promo_field1 = xprofile_get_field_data( 'Earn a percentage of credits received by referrals', 1); $promo_field2 = xprofile_get_field_data( 'Points earned when you post content on forums', 1); $promo_field3 = xprofile_get_field_data( 'Points earned when you complete registration', 1); xprofile_set_field_data( 'Earn a percentage of credits received by referrals', $user_id, 100 ); xprofile_set_field_data( 'Points earned when you post content on forums', $user_id, 200 ); xprofile_set_field_data( 'Points earned when you complete registration', $user_id, 300 ); } add_action( 'bb_user_login', 'action_bb_user_login', 10, 1 );
September 28, 2017 at 15:31 #175086RaduModeratorchange priority (value 10) to a higher value or instead of using bb_user_login to use wp_login or wp_authenticate try those instead.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 1, 2017 at 03:26 #175310psmorrowParticipantHi Radu,
I’m convinced that i’m not able to hook into any login / redirect / authentication WP/BP function. My theory is that its due to installing W3 Total Cache. I think it leaves code behind even when uninstalled.
Quite unfortunate for me that I don’t have a backup prior to installing this plugin 🙁
Would you consider installing this plugin and testing if you encounter any issues?
Cheers!
October 2, 2017 at 17:20 #175434RaduModeratorHi,
I cannot see any issue using W3 Total Cache and using the theme… if you still have the plugin active, it’s safe to de-activate the W3 Total Cache on live but purge/empty all caches before do it.Then just test your snippets if haves effect on the frontend but using an incognito window(not keeps browser cache.)
Anyway, the snippets work on my end…and also on other users, maybe it’s an isolated issue? You can try to update the functions.php file from wp-admin -> theme options -> edit -> kleo-child -> functions.php maybe if you are using FTP client to edit in a dummy place… test it.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Plugins questions’ is closed to new topics and replies.