Jump to content

redirect after login


moein

Recommended Posts

Hello all
my theme itself has the feature of logging in with Google but there are some drawbacks
Hope you can help me

My theme uses this file (socials-auth.php) to login with Google
http://txt.do/1ktj8

I want the user to not redirect after logging into /my-account page and become the same as the current page
line 57 and 75

wp_redirect( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) );

 

And after the user login, his Gmail name will appear with a random number,
But I want to get the name and lastname from his Google account and display it on the site
(pre_user_nickname)
line 62

		if ( ! empty( $userProfile ) ) {
			$email = $userProfile->email;

			if ( email_exists( $email ) ) {
				$user_data = get_user_by( "email", $email );
				mf_login_user( $user_data );
				wp_redirect( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) );
			} else {
				list( $user_login, $no_matter_data ) = explode( '@', $email );
				$u_login            = $user_login . rand( 1000, 9999999 );
				$password           = bin2hex( random_bytes( 15 ) );
				$user_register_data = [
					'user_login' => apply_filters( 'pre_user_login', $u_login ),
					'user_email' => apply_filters( 'pre_user_email', $email ),
					'user_pass'  => apply_filters( 'pre_user_pass', $password ),
				];

 

Hope you can help me
thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.