This topic has 7 replies, 2 voices, and was last updated 9 years by ScotKinney.
-
Author
-
July 1, 2015 at 01:11 #65898ScotKinneyParticipant
I need to use the woocommerce login page for a separate desktop app we made. I can’t seem to find the code to redirect them to their own profile page after logging in. I also want already logged in users to go their profile when they open the app. The app uses awesomium which is similar Chrome so anything that works in Chrome will work here. I need to know what to put in place of ?user=username because it doesn’t work.
Peter’s redirect doesn’t work for this either.COPY CODE// redirect to profile instead function scot_wc_login_redirect( $redirect ) { $redirect = 'http://www.alterverse.com/members/?user=username/'; return $redirect; } add_filter('woocommerce_login_redirect', 'scot_wc_login_redirect');
Thanks!
ScotJuly 1, 2015 at 01:23 #65900sharmstrModerator1 – Have you tried Peters Login Redirect plugin? It has the username variable. See attached.
2 – BP has functions that will return that for you. bp_loggedin_user_domain is one of them. https://codex.buddypress.org/developer/playing-with-the-users-id-in-different-contexts/
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
Attachments:
You must be logged in to view attached files.July 1, 2015 at 02:58 #65909ScotKinneyParticipantFrom what I understand Peter’s redirect doesn’t currently work for this: https://wordpress.org/support/topic/stopped-working-for-profile-page. I installed it and set it and it just directed me to the regular woocommerce account page.
So, you don’t know anything I can place in the spot there that says ?user=username
It seems like there should be something yet I’ve spent most of the day looking and no one seems to have a simple answer.July 1, 2015 at 03:41 #65913sharmstrModeratorI use it. That screen shot was from my site. It works. Did you try it without your scot_wc_login_redirect function active?
Why do you have ‘?user=username’? Even if you were able to resolve ‘username’, your redirect would send them to /members/?user=sharmstr. That’s not valid.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 1, 2015 at 03:53 #65914sharmstrModeratorLook at what this produces
COPY CODEadd_action('init','show_profile_url'); function show_profile_url() { echo bp_core_get_user_domain( get_current_user_id() ); }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 1, 2015 at 04:08 #65918ScotKinneyParticipantThanks man, but I’m not a coder, that’s why I’m using WordPress and BuddyPress and this theme…lol
I just used that user=username bit as a placeholder so you could see the total url.
But yes, I disabled my function first. Peter’s login redirect doesn’t hook into the woocommerce_login_redirect.The code you posted above is really greek to me. I have no idea where to put it or how to use it.
As I understand it the username is dynamic so somehow I have to get the woocommerce logi redirect to pull it form somewhere but I have no idea how. You’d have to be completely specific, step by step.I also want to add some code so that if the user still is logged in via cookies the next time he comes to the page it redirects him to his profile too if you know how to do that.
Any help is appreciated!July 1, 2015 at 05:01 #65923sharmstrModeratortry this code instead of yours.
COPY CODEadd_filter('woocommerce_login_redirect', 'wcs_login_redirect'); function wcs_login_redirect( $redirect ) { $redirect = 'http://www.alterverse.com/wp-content/plugins/peters-login-redirect/wplogin_redirect_control.php'; return $redirect; }
Then go into peters redirect settings and add this to the “all other users”
COPY CODEhttp://www.alterverse.com/members/[variable]username[/variable]
I’ve tested it with my woo login form on the checkout page and it works.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 1, 2015 at 21:17 #66062ScotKinneyParticipantThis seems to do the trick:
COPY CODE// Custom redirect for users after logging in with Woocommerce MyAccount page - (Scot) // redirect to profile instead function scot_wc_login_redirect( $redirect, $user ) { $redirect = bp_core_get_user_domain($user->ID); return $redirect; } add_filter('woocommerce_login_redirect', 'scot_wc_login_redirect', 11, 2);
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.