通过另外一个对象:
stdClass Object ( [identity_token] => 205eaef78c5240 [date_creation] => Sun, 05 Aug 2018 14:08:46 +0200 [date_last_update] => Tue, 14 Aug 2018 16:25:22 +0200 [provider] => discord [provider_identity_uid] => myuid [source] => stdClass Object ( [name] => Discord [key] => discord [access_token] => stdClass Object ( [key] => somekey [date_expiration] => 08/21/2018 16:25:22 ) [refresh_token] => stdClass Object ( [key] => somekey ) ) [id] => https://discordapp.com/users/431904802918891531/ [displayName] => Tojps [preferredUsername] => Tojps [emails] => Array ( [0] => stdClass Object ( [value] => myemail@gmail.com [is_verified] => 1 ) ) [accounts] => Array ( [0] => stdClass Object ( [domain] => discord.com [userid] => 431904802918891531 [username] => Tojps ) ) [browser] => stdClass Object ( [agent] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 [type] => Chrome [version] => stdClass Object ( [major] => 68 [full] => 68.0.3440.106 ) [platform] => stdClass Object ( [name] => Windows [type] => Desktop ) ) ) 1
我尝试通过ID将帐户与discord.js机器人建立连接,但是message.author.id
返回了一个不同的值。
我试图通过以下方式找到不和谐标签:
function oa_social_login_store_extended_data ($user_data, $identity)
{
// $user_data is an object that represents the newly added user
// The format is similar to the data returned by $user_data = get_userdata ($user_id);
// $identity is an object that contains the full social network profile
//Example to store the gender
$userid = "";
echo print_r($identity);
foreach ($identity-> accounts as $value) {
$userid = $value -> username . $value -> discriminator;
}
update_user_meta ($user_data->ID, 'discord_id', $userid);
}
结果为“ Null”。 有没有办法使用唯一密钥连接到帐户?