Steam Authentication & Integration

Steam Authentication & Integration 1.6.3

No permission to download
ohh, you have to sign in with steam. I thought this was a thing where you can attach your steam account to you XF account.

It does. If you have a forum account then you associate steam with your forum account, if you don't have one, you create a forum account when you log in through steam. Either way the forum account is there. Using steam allows the person to not have to remember another username/password for their forum account. Pretty much a single sign on if you will.
 
So I was prepared to push out a release last night and got it all synced to the master branch on github. Got an alternative Steam login bar that matches other XenForo bars (Twitter, Facebook, etc.) and a few other requests regarding the login bar done. I decided to do one final sweep for bugs and found one that isn't terrible, but it's definitely a problem.

Only testing this on a small forum I wouldn't have expected to see this, but apparently one of my forum members decided to buy every game on steam. Yes, buy every game on steam. Which creates a problem in the ACP games list. Because the games list isn't paginated, when visiting that section in the ACP it hangs for a long time trying to load all those external product images from steam (and in turn I now have 2,000+ steam images cached for HTTPS proxy, whoops).

I can resolve this one of two ways: Just remove the image code, or not be lazy and properly paginate the data. So I'm going for the latter. Once I get that sorted, I'll add options to do the same for the steam statistics pages. But to get other features out to you sooner, the steam statistics pagination won't be in this upcoming update.
 
HowIChrgeLazer updated Steam Authentication & Integration with a new update entry:

Version 1.4.3 Changelog

* Added HTTPS support through XenForo's Image Proxy
* Added an alternative option for login bar to match XenForo
* Added option to display login bar in the sidebar visitor panel
* Added login bar to the Xenforo login page
* Now hiding banned users' SteamProfiles and omitting them from statistics
* Paginated Steam games list in ACP (will eventually add search features)

Upcoming Features
--------------------------------
* Code cleanup
* Searchable game list in ACP (easier to find Appid's for...

Read the rest of this update entry...
 
I found a few bugs that you may not have noticed.

1.) In the templates steam_public_played, steam_public_recent, you've written (in the title part):
<span class="steamstats_title_count"> [...] <span>
Which is missing a "/" on the closing tag.

2.) There's a pretty big formatting issue when the page is squished horizontally. It messed up a bit with the responsive design system.
A simple solution to this is to swap every instance pair of span tags around, so the number comes first.
Example:
Code:
<xen:container var="$steamProfStats">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topUsersRecent}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topUsersRecent_hours}</span><span class="steamstats_title_user">{xen:phrase steam_stats_topUsersRecent_user}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_user"><span class="steamprofile" title="{$value.steamprofileid}"></span>{xen:helper username, $value}</span></div>
</xen:foreach>
</div>

Then, in the steam_stats.css file, change it to this:
Code:
/* Steam Authentication & Integration CSS */
    .steamstats_header
    {
        font-size: 150%;
        font-weight: bold;
        height: 24px;
        border-bottom: 2px solid @primaryLightish;
        padding: 8px;
    }
    .steamstats_title_user
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_game
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_count
    {
        display: block;
        float: right;
        text-align: right;
    }
    .steamstats_list
    {
        font-size: 125%;
        height: 24px;
        border-bottom: 1px solid @primaryDark;
        padding: 8px;
    }
    .steamstats_game_img
    {
        padding-right: 4px;
        width: 68px;
        height: 24px;
        vertical-align:top;
    }
This will cause the numbers to take up whatever space they need, and the titles will fill up the rest of it, while hiding any words that overflow.

Anyway, thanks for making this! :)

Edit:
Also, are there plans to add privacy settings to your steam account? (Some users do not want their Steam accounts being shown, while other do).
 
Last edited:
It seems that all user criteria-related features are broken in Xenforo with this current update, I don't know what exactly is wrong, or if it's only me, but I get this every time I look at ANYTHING regarding custom user criteria.
Code:
Fatal error: Call to undefined method Steam_Helper_Steam::getAvailableGames() in xenforo/library/Steam/Listener.php on line 80
 
It seems that all user criteria-related features are broken in Xenforo with this current update, I don't know what exactly is wrong, or if it's only me, but I get this every time I look at ANYTHING regarding custom user criteria.
Code:
Fatal error: Call to undefined method Steam_Helper_Steam::getAvailableGames() in xenforo/library/Steam/Listener.php on line 80
Yeah, I can't create trophies now. I just get that.

Edit:
My temporary solution, add this to library/Steam/Helper/Steam.php (inside the class)

Code:
    public function getAvailableGames() {
        $rVal = array();
        $db = XenForo_Application::get('db');
        $results = $db->fetchAll("SELECT game_id, game_name, game_link, game_logo FROM xf_steam_games ORDER BY game_name;");
        foreach($results as $row) {
            $rVal[] = array(
                'id' => $row['game_id'],
                'name' => $row['game_name'],
                'link' => $row['game_link'],
                'logo' => $row['game_logo']
            );
        }
        return $rVal;
    }

No idea if it breaks anything else by doing that, though.
 
Last edited:
I thought I should give you a bit more information on my change request.
So to start with, here's what the Steam list looks like currently when resized:
http://gfycat.com/ExhaustedRepentantHoiho
And here's after the change:
http://gfycat.com/KindSerpentineAfghanhound

And here's all the changes I made:
Template steam_stats.css
Code:
/* Steam Authentication & Integration CSS */
    .steamstats_header
    {
        font-size: 150%;
        font-weight: bold;
        height: 24px;
        padding: 8px;
    }
    .steamstats_title_user
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_game
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_count
    {
        display: block; 
        float: right; 
        text-align: right;
    }
    .steamstats_list
    {
        font-size: 125%; 
        height: 24px; 
        padding: 8px;
    }
    .steamstats_game_img
    {
        padding-right: 4px;
        width: 68px;
        height: 24px;
        vertical-align:top;
    }

Tempalte steam_public_index
Code:
<xen:container var="$steamProfStats">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topUsersRecent}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topUsersRecent_hours}</span><span class="steamstats_title_user">{xen:phrase steam_stats_topUsersRecent_user}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_user"><span class="steamprofile" title="{$value.steamprofileid}"></span>{xen:helper username, $value}</span></div>
</xen:foreach>
</div>

Tempalte steam_public_owned
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topOwned}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topOwned_count}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topOwned_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.count}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>

Tempalte steam_public_played
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topPlayed}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topPlayed_hours}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topPlayed_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>

Tempalte steam_public_recent
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topPlayedRecent}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topPlayedRecent_hours}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topPlayedRecent_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>
 
I thought I should give you a bit more information on my change request.
So to start with, here's what the Steam list looks like currently when resized:
http://gfycat.com/ExhaustedRepentantHoiho
And here's after the change:
http://gfycat.com/KindSerpentineAfghanhound

And here's all the changes I made:
Template steam_stats.css
Code:
/* Steam Authentication & Integration CSS */
    .steamstats_header
    {
        font-size: 150%;
        font-weight: bold;
        height: 24px;
        padding: 8px;
    }
    .steamstats_title_user
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_game
    {
        display: block;
        height: 24px;
        overflow: hidden;
    }
    .steamstats_title_count
    {
        display: block;
        float: right;
        text-align: right;
    }
    .steamstats_list
    {
        font-size: 125%;
        height: 24px;
        padding: 8px;
    }
    .steamstats_game_img
    {
        padding-right: 4px;
        width: 68px;
        height: 24px;
        vertical-align:top;
    }

Tempalte steam_public_index
Code:
<xen:container var="$steamProfStats">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topUsersRecent}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topUsersRecent_hours}</span><span class="steamstats_title_user">{xen:phrase steam_stats_topUsersRecent_user}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_user"><span class="steamprofile" title="{$value.steamprofileid}"></span>{xen:helper username, $value}</span></div>
</xen:foreach>
</div>

Tempalte steam_public_owned
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topOwned}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topOwned_count}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topOwned_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.count}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>

Tempalte steam_public_played
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topPlayed}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topPlayed_hours}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topPlayed_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>

Tempalte steam_public_recent
Code:
<xen:container var="$steamProfNoJS">1</xen:container>
<div class="sectionMain">
<xen:title>{xen:phrase steam_stats_topPlayedRecent}</xen:title>
<div class="steamstats_header"><span class="steamstats_title_count">{xen:phrase steam_stats_topPlayedRecent_hours}</span><span class="steamstats_title_game">{xen:phrase steam_stats_topPlayedRecent_game}</span></div>
<xen:foreach loop="{$gameStats}" key="$key" value="$value">
<div class="steamstats_list"><span class="steamstats_title_count">{$value.hours}</span><span class="steamstats_title_game"><a href="{$value.link}"><img class="steamstats_game_img" src="{$value.logo}" />{$value.name}</a></span></div>
</xen:foreach>
</div>

Hey Skiphs,

Thanks for the bug report/request, I actually coded that up last night and pushed it to the dev branch. I also added another span so the text now aligns properly with the images. Pushed it out this morning about 45 minutes ago. :)
 
Hello everyone,

So an update on the development thus far:
  • Began cleaning up and documenting code, probably about 40% done with this
  • During the code cleanup and consolidation I was able to remove the redundant jsonproxystats.php file
  • Implemented templates fixes as discussed above
The cleanup is the longest part of this so far, mainly because I'm reorganizing the logic and getting rid of duplicate code and putting them into functions. This requires me to have to check and re-check all the features of Steam Authentication to make sure my changes haven't broken anything. Beyond that, I want to make a push to get this into a "final" state. With the amount of changes that are happening this will probably be slated as a 1.5.0 (or maybe even a 2.0) release.

Current plans for the future:
  • Allow admins to choose how many players/games to display on stats pages w/pagination
  • Setup breakdown stats for users and games
  • Setup AJAX search in the ACP for the full steam games list
  • Add the ability to reload game information
    • This will function like a link in the ACP User list (Ban user, etc)
    • Useful if game logo updates or game name changes
    • Will need to bug check this to make sure it doesn't effect criteria already set
  • Try to setup better error handling for SteamProfile badges
    • If NULL is received from Steam Community API display the error template
  • Add user privacy settings to hide SteamProfile badge
My goal for Steam Authentication, once the above features are in place is to consider it in essentially a "final" state. I will continue to improve and support it afterwards, but I feel the above list caps off what this addon needs to accomplish for a forum. I want to make sure it has the functionality the majority of the people want, without it becoming too bloated.

Finally, I know there has been a request in the past the allow admins to disassociate users from their steam account. I'm unfortunately going to pass on this. Official XenForo external accounts don't operate in this manner. Also, with the 1.4.3 update, if you ban a user, their SteamProfile won't show up on your forum any longer. The banned user will also not show up in the stats count. I think that is a fair compromise, but I'd like to hear people's opinions on this school of thought on this subject.
 
Also, are there any plans on adding Steam achievements -> trophies? Although I don't even know how you'd handle that.
 
Also, are there any plans on adding Steam achievements -> trophies? Although I don't even know how you'd handle that.

It could theoretically be done, but the API requests would be inefficient. You'd have to do one request per user per game each time you ran the cron. I could have an option to only do updates for appids specified like I do the inclusion and exclusion list, but it's very limiting and not very user friendly. Then then end user has to deal with the naming of achievements:

{
"playerstats": {
"steamID": "xxxxxxxxxxxxxxxxx",
"gameName": "Team Fortress 2",
"achievements": [
{
"apiname": "TF_PLAY_GAME_EVERYCLASS",
"achieved": 1
},
{
"apiname": "TF_PLAY_GAME_EVERYMAP",
"achieved": 1
},
{
"apiname": "TF_GET_HEALPOINTS",
"achieved": 1
},
{
"apiname": "TF_BURN_PLAYERSINMINIMUMTIME",
"achieved": 1
},
{
"apiname": "TF_GET_TURRETKILLS",
"achieved": 1
},
{
"apiname": "TF_KILL_NEMESIS",
"achieved": 1
},
{
"apiname": "TF_GET_CONSECUTIVEKILLS_NODEATHS",
"achieved": 1
},
{
"apiname": "TF_GET_HEALED_BYENEMY",
"achieved": 1
},

They aren't terribly named, but if you do a check for too many games that box selection is going to be huge. Plus the end user needs to figure out which achievement is actually which. It's not impossible, I just hate not being able to effectively check every game a person owns for achievements with just one API request.

I'll look into possibly adding it with the warning of don't over do it if you enable this feature. I may just wait until they update their API though.
 
Last edited:
After skimming through database tables, does anybody have an easy method of find SteamIDs or CommunityID information in database tables?

Thanks,
- Jack
 
After skimming through database tables, does anybody have an easy method of find SteamIDs or CommunityID information in database tables?

Thanks,
- Jack

For what purpose? If I know the context in which you're using them, I can be of help. You can pull SteamID64 data from XenForo using a user's ExternalAuth information. Here's an example of getting that data in a thread message: {$message.externalAuth.steam}. This is how I build the SteamProfiles in posts.

If you're looking to convert that SteamID64 value into a SteamID formatted like STEAM_0:X:XXXXXX, you can use the provided helper: {xen:helper steamid, $value} (in the above case $value would be $message.externalAuth.steam).

If you're looking to get their custom profile URL (like http://steamcommunity.com/id/HowIChrgeLazer/) you won't be able to do that. However, SteamID64 works in place of that (like http://steamcommunity.com/profiles/76561197967267537 is my SteamID64 value)
 
For what purpose? If I know the context in which you're using them, I can be of help. You can pull SteamID64 data from XenForo using a user's ExternalAuth information. Here's an example of getting that data in a thread message: {$message.externalAuth.steam}. This is how I build the SteamProfiles in posts.

If you're looking to convert that SteamID64 value into a SteamID formatted like STEAM_0:X:XXXXXX, you can use the provided helper: {xen:helper steamid, $value} (in the above case $value would be $message.externalAuth.steam).

If you're looking to get their custom profile URL (like http://steamcommunity.com/id/HowIChrgeLazer/) you won't be able to do that. However, SteamID64 works in place of that (like http://steamcommunity.com/profiles/76561197967267537 is my SteamID64 value)

I'm programming a plugin for Source-based servers to grant administration privileges to administrators for XF. (Sourcemod/Sourcepawn)
 
Hmmm... I suppose you could setup a cron that does an SQL select query joining the xf_external_auth and xf_user tables. Check if a user id has a value of 1 for IsAdmin in the user table. Do the SteamID64 to SteamID conversion (have some stored MySQL procedures like this: https://forums.alliedmods.net/showp...86cce92e740ff2a2b6b97&p=1593324&postcount=306) and put that data into your admin MySQL table for SourceMod (add in any flags you desire to the insert/update query).

Anytime it runs it'll update your sql table. Make sure to have a check to avoid duplicate steamids.
 
I do not have the table 'xf_external_auth' but I have 'xf_user_external_auth' and it doesn't provide the CommunityIDs, just 'provider_key' & 'provider' aside from userID & 'extra_data'.
 
Top Bottom