action hook for signin

Is there a hook similar to the one below but for when a user logs in (not registers)?

//This action is called whenever Social Login adds a new user
add_action ('oa_social_login_action_after_user_insert', 'oa_social_login_store_extended_data', 10, 2);

Thank you

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    Hi Jonah,

    No, there isn't. There is:
    - oa_social_login_action_before_user_login
    - wp_login (for Wordpress login hook)
    - oa_social_login_action_before_user_redirect (after login or register, and before redirection, which is the next step).
    Would you need some specific action ?

    Thanks.

Answers

  • Thank you Frederic, that's perfect. I searched for the first one you put oa_social_login_action_before_user_login, and found this:
    https://github.com/wp-plugins/oa-social-login/blob/master/filters.txt

    From the portion of it pasted below, I found that there is also a $new_registration parameter. I was able to use this and it looks like it should weed out the registration ones from pure sign up.

    -Jonah

    //This function will be called before Social Login logs the the user in
    function oa_social_login_do_before_user_login ($user_data, $identity, $new_registration)
    {
    //true for new and false for returning users
    if ($new_registration)
    {
    echo "I am a new user";
    }
    else
    {
    echo "I am a returning user";
    }

    //These are the fields from the WordPress database
    print_r($user_data);

    //This is the full social network profile of this user
    print_r($identity);
    }
    add_action ('oa_social_login_action_before_user_login', 'oa_social_login_do_before_user_login', 10, 3);
  • Ah, well done.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.