Discord Username

Hey I have been having a real hard time pulling the full discord username "username#1234". I am trying to get it to pull and put it in the nickname of wordpress profile. If anyone can help with this it would be greatly appreciated.

Best Answer

  • Damien_ZARADamien_ZARAMemberAdministratorOneAll Team
    Answer ✓

    Hello,

    As answered by ticket, you can use this code :

    $discordID = '';
    if (property_exists($identity, 'accounts') && is_array($identity->accounts))
    {
    foreach ($identity->accounts as $account)
    {
    $discordID = $account->username;
    }
    }
    $user_login = $discordID;

    This would set the Discord username (xxxxx#111111) as user login.

    Best regards,
    Damien

    This discussion has been closed.

    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.