Hello,
you can use an action like this to save the username/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]);
}
}
}
}
//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 note that I haven’t tested the code, but it should do the trick.
Also seen here:
https://support.oneall.com/forums/discussion/8064/having-trouble-storing-the-discord-id-after-a-user-signs-in-with-discord-wordpress
Best Regards,
-
This reply was modified 4 years, 7 months ago by
Claude.