getting steam id within the page after logging in with steam

edited September 2021 in Questions

Hi

I'm quite new at this so I apologise in advance if it is obvious

would anyone be able to tell me what code I would need to be able to get a users steam ID to show on a wordpress site page if someone has logged in with steam?

thanks!

Answers

  • Damien_ZARADamien_ZARAMemberAdministratorOneAll Team

    Hi Gary,

    Sure, to get the Steam ID on WordPress, you can take a look here to use our hook : http://docs.oneall.com/plugins/guide/social-login-wordpress/#3a

    The Steam ID should be accessible in the function (from previous link about hook) using this code (not tested) :

    if (property_exists($identity, 'accounts') && is_array($identity->accounts))
    {
    foreach ($identity->accounts as $account)
    {
    if (!empty($account->userid))
    {
    $steamID = $account->userid;
    }
    }
    }

    Then save it anywhere you want (if you want it to a specific table, or in the user meta) to be able to show it later.
    Best regards,

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.