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,

  • Locksmith Keighley provides trusted and professional services, ensuring quick solutions for lockouts, repairs, and security upgrades. With expertise in residential, commercial, and automotive locks, they deliver reliable assistance whenever needed. Whether it’s emergency access or enhancing home safety, their skilled team is always ready to help. Just like getting steam id within the page after logging in with steam simplifies online gaming, Locksmith Keighley simplifies securing your property with efficiency and care.

  • Hello Guys,
    When you log in with Steam, the SteamID is usually returned through the authentication response or available via the Web API after the session is established. If you’re not seeing it on the page, check the callback URL parameters or inspect the JSON response in your browser’s network tab. That’s often where the ID is exposed before being rendered.I ran into something similar while connecting progress saving for a mini-game project on https://stickmanpartyapks.com, and pulling the ID directly from the auth response solved it. Hope that helps anyone troubleshooting the same issue.

  • I had to figure this out last year when I wanted members of a small gaming community to be able to log in with Steam and then see their ID displayed on their profile pages—turns out after the OpenID handshake, Steam returns a URL with the ID, so you just need to parse that string and grab the numbers. Once I got that working, it reminded me of browsing https://www.gambody.com/ for game character models to print, because both cases are about pulling something tied to a game identity—whether it's a Steam ID for login access or a 3D model of Master Chief to print and paint. The logic is similar: grab the right identifier from the source and use it to give people what they came for. In WordPress, hook into the authentication flow, catch that return URL, strip the ID, and you're set.

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.