Choosing which account to log in and forcing google to log out
-
If the browser is already logged in to a google account, this plugin natively does not allow you to choose another account to login.
And after logging out, it does not disconnect google accounts.
After researching a lot, I found a way to solve this problem,
I share it here, and I hope it helps other users:
You must access the plugin folder on your hosting:
/wp-content/plugins/heateor-social-login/public/
In the file:
class-heateor-social-login-public.php
On line 1718, responsible for generating the google login link.
add right after:
home_url ()
the following excerpt:
. "& prompt = select_account"
This will always display the list of logged-in users and the option to add another account, instead of logging in if there is already a logged-in user.
As long as this code is not inserted by you in the plugin, all users will need to add it manually whenever the plugin is updated.
01 – Can you add it in the next update?
02 – I found a problem while testing this solution:
If the “Same page where user logged in” option
is enabled.When logging out of one account, and trying to log in to another, you need to update the page manually so that it completes the redirect, the page hangs.
However, if any other redirection option is selected, everything works fine.
03 – To log out after disconnecting from the site:
I inserted the code below in the functions file, it takes you to a page where you will be asked if the user also wants to disconnect the google accounts logged into the browser.
function redirect_after_logout_f () { wp_redirect ('logout_google'); exit (); } add_action ('wp_logout', 'redirect_after_logout_f');
You need to create a
/logout_google/
pageThere will be a button, with the title YES with the link:
https://accounts.google.com/Logout
which disconnects all google accounts from the browser.
Another button can be added on this page, with the title NO,
directing to the home page without disconnecting google accounts.
- The topic ‘Choosing which account to log in and forcing google to log out’ is closed to new replies.