Plugin Support
Robert
(@robertnextendweb)
Hi @aaron13223
Please note that we cannot provide support for custom coding, so that must be handled by you. As for hooks, we have the “nsl_login” action, which is fired after someone has logged in with either of the providers:
https://social-login.nextendweb.com/documentation/for-developers/hooks/#login
You can also use the provider id variant if you want only one provider.
If you are looking for one that is fired after a link happens, you can use the nsl_{{provider_id}}_link_user action:
https://social-login.nextendweb.com/documentation/for-developers/hooks/#nsl-link-user
where the provider id is “google” for Google, “fb” for Facebook, and “twitter” for X/Twitter.
Hi @robertnextendweb ,
Thanks a lot for your help! nsl_{{provider_id}}_link_user action is what I was looking for.
I have one other question but it’s completely okay if you don’t answer since I understand custom code is out of scope.
Do you think wp_get_session_token() will work well in this context of the nsl action to get the session token of the user who just linked their social account?
Thanks again for your help!
Plugin Support
Laszlo
(@laszloszalvak)
Hi @aaron13223
That hook is probably not the best option for that purpose, because this hook gets triggered whenever a social media account is linked to a WordPress account. This can happen both:
- when the user is already logged in, e.g. when a logged in user links a social media account manually to the currently logged in WordPress account )
- or when the user is not logged in yet, e.g. when we have to register a new WordPress account and link the social media account to the account that we created ( this happens before we log the user in to the connected WordPress account )
The wp_get_session_token() function retrieves the token from the logged_in cookie, which requires the user to be logged in already. So you probably need to prepare your code for both cases or you should use rather the nsl_login action hook that Robert suggested earlier, as we fire that action only when we the user logs in with social login. With the 2nd approach, I don’t really think a reason you should invalidate the other session tokens for the already logged in users who link a social media account with the link button, as you might have already invalidated the other tokens at the time the user logged in with the social login ( or traditional login if you implemented it for that, too ).
But please note that, as Robert mentioned earlier, custom coding is out of the scope of our support, so we won’t be able to provide help you in implementing this.
Best regards,
Laszlo.