• Resolved delaitec

    (@delaitec)


    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/ page

    There 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.

    • This topic was modified 3 years, 6 months ago by delaitec.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter delaitec

    (@delaitec)

    After publishing the solution, I tried to edit step 03 to make it clearer.
    But I didn’t have permission.

    For this reason I am posting step 03 Adjusted:

    03 – To log out after disconnecting from the site:

    I inserted the code below in the functions file:

    function redirect_after_logout_f () {
    wp_redirect ('logout_google');
    exit ();
    }
    add_action ('wp_logout', 'redirect_after_logout_f');

    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.

    You need to create the logout page with this exactly premalink logout_google

    There 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.

    • This reply was modified 3 years, 6 months ago by delaitec.
    • This reply was modified 3 years, 6 months ago by delaitec.
    Thread Starter delaitec

    (@delaitec)

    Obs.

    On Step 03, the page name link is a “-” instead “underline”:
    Ex.: logout-google

    Se the full code:

    function redirect_after_logout_f () {
    wp_redirect ('logout-google');
    exit ();
    }
    add_action ('wp_logout', 'redirect_after_logout_f');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Choosing which account to log in and forcing google to log out’ is closed to new replies.