I can't seem to get the discord id of a user when they sign in. How would I do it?
Here a more complete action to save the Discord username, userid and discriminator:
//Handle data retrieved from a social network profile
function oa_social_login_store_extended_data ($user_data, $identity)
{
if ($identity->source->key == 'discord')
{
$account = array_shift($identity->accounts);
if (isset ($account->username)
{
$parts = explode ('#', $account->username);
if (count ($parts) == 2)
{
update_user_meta ($user_data->ID, 'discord_username', $parts[0]);
update_user_meta ($user_data->ID, 'discord_discriminator', $parts[1]);
}
else
{
update_user_meta ($user_data->ID, 'discord_username', $parts[0]);
}
}
if (isset ($account->userid)
{
update_user_meta ($user_data->ID, 'discord_userid, $account->userid);
}
}
}
//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);
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.
Answers
Hello,
you can use the following hook:
http://docs.oneall.com/plugins/guide/social-login-wordpress/#3a
And then a function like this: