• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[GP] Steam Stats

Thanks largely to dmnkhhn's and Darkimmortal's help in explaining to me how to get this working, I'm able to release another basic add on. This addon will enable you to display a steam group's statistics on your forum sidebar.

gp_steam.webp

How To Install
  1. Files
    • Download the attached zip file, extract it.
    • Upload it's contents to your forum root.
  2. Import XML file
    • ADMIN CP > Home > Install Add-on > Install from file on server
      • install/data/addon_GP_Steam.xml
  3. Configure Steam Block
    • ADMIN CP > Home > Options > [GP] Steam Stats
      • Configure to suit.
      • Save Changes
  4. Template Edits
    • ADMIN CP > Appearance > Templates > forum_list
      • Find: </xen:sidebar>
      • Above, add: <xen:include template="GP_Steam" />
      • Save all Changes
I appreciate it's a fairly niche requirement but as I was doing it for my own needs anyway I figured I might as well release it as there might be a couple of others out there who'd also like it :).

gp_steam_options.webp
 

Attachments

Version History
  • 31st Oct 2010 - v1.0.0
    • Initial Release
  • 1st Nov 2010 - v1.0.1
    • GP_Steam_Group_Name - Description changed and image added to make it more obvious that it needs to be the custom url for your steam group.
    • Images Directory - Moved images from gp-steam to gp/steam to rationalise folders if multiple [GP] addons are installed.
Requests for Future Implementation
  • Steam profiles for each user - Currently not possible due to lack of user profile fields
  • Show users in-game with the game they're playing - Believed not to be possible due to the random order in which steam display members in a group
FAQ
  • My Steam Group does not display any game play statistics.
    • Unfortunately, steam does not display this data for groups with over 150 members. This means that the mod is unable to pull this data from steam and display it.
  • I receive an error containing "URL file-access is disabled in the server configuration" when I enable this mod.
    • This is due to a server configuration. You must edit you php.ini file to set allow_url_fopen = ON and then restart your server.
 
Very nice mod indeed thanks GP :).

Am having one small problem with it, it isn't picking up our name, unsure why but when hover over the members link it only shows the first word in our name. Is it possible to, or would you be able to make it possible to, use the group ID instead of the name?

**Edit** OK I'm a nub and figured it out, have to use the name on your custom url ... d'oh.
 
Beautiful :) simple yet effective. This will be perfect :)

Next task, steam profiles for each user? :D

Thanks!
 
Very nice mod indeed thanks GP :).

Am having one small problem with it, it isn't picking up our name, unsure why but when hover over the members link it only shows the first word in our name. Is it possible to, or would you be able to make it possible to, use the group ID instead of the name?

**Edit** OK I'm a nub and figured it out, have to use the name on your custom url ... d'oh.

I've updated the mod to now include a better description and image of what the GroupName should look like, as it wasn't immediately obvious before.
gp_steam_options-png.5382

Beautiful :) simple yet effective. This will be perfect :)

Next task, steam profiles for each user? :D

Thanks!

As far as I'm aware, this isn't currently possible due to a lack of user profile fields as there is no other way to pull a specific user's steam ID (unless it matched their forum name, which is unlikely). It does look like custom profile fields, or something similar, is going to be included in a later version of xF though, so it might be possible in the future. What sort of information did you have in mind, something like steamcard do;
ir15h.png

that would appear on a user's profile or something else?

Would be nice if could show users in-game with the game they're playing??

I haven't had time to look into this properly, but it might be possible to do it by pulling info from http://steamcommunity.com/groups/GroupName/members. How would you propose to display this information, though? If you have a large group of players on-line then it'd be too big to display this kind of information in the sidebar.
 
I just saw it as a list below the # members, # in-game etc. Depending on how big the text/picture would be just have an option so the admin could cut it off at whatever number of peeps
 
This is great to see! Although, I think our group has too many users to show game stats unfortunately: http://steamcommunity.com/groups/ducksoup-gaming

I would love to see a tighter integration of Steam in Xenforo and would support any mods that do so. We used to use this in our VB4 site using custom profile fields.

Unrelated-ish, if someone is interested in creating the ability to show Source Dedicated Server info in Xenforo (map, players online etc) I would support such a mod as well.
 
ErrorException: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: URL file-access is disabled in the server configuration - library/GP/Steam/ControllerPublic/Index.php:13
 
ErrorException: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: URL file-access is disabled in the server configuration - library/GP/Steam/ControllerPublic/Index.php:13
I fixed this with a php.init with this on
allow_url_fopen = ON
 
I just saw it as a list below the # members, # in-game etc. Depending on how big the text/picture would be just have an option so the admin could cut it off at whatever number of peeps

Having looked into this further, I don't think it's possible unfortunately.

The order in which steam displays members seems to be officers first (regardless of on-line or off-line status) and then randomly between on-line, off-line and in-game regular group members. To be able to do what you want, the data would need to be presented something like;

HTML:
<!-- group members -->
     <!-- officers -->
          All officer info
     <!-- /officers -->
     <!-- in-game members-->
          All in-game members info
     <!-- /in-game members-->
     <!-- on-line members-->
          All on-line members info
     <!-- /on-line members-->
     <!-- off-line members-->
          All off-line members info
     <!-- off-line members-->
<!-- /group members -->

You'd then be able to say start pulling data from <!-- officers --> and stop pulling at <!-- /in-game members-->, that'd give you all the officers and in-game users.

However, that data is actual displayed as such;

HTML:
<!-- group members -->
All_officer_info, random_off-line, random_on-line, random_on-line, random_in-game, random_on-line, random_off-line, random_on-line, random_on-line, random_on-line, random_in-game, random_off-line, random_off-line, random_in-game,
<!-- /group members -->

You can tell it to start looking at <!-- group members --> but then not where to cut it off due to the random order. If you tell it to cut off at the end of random_in-game, then it'll still pull any on/off-line members who appear before this and it'll also cut off after the first in-game member, so you lose the rest. I don't know any way to get around this problem.


This is great to see! Although, I think our group has too many users to show game stats unfortunately: http://steamcommunity.com/groups/ducksoup-gaming

I would love to see a tighter integration of Steam in Xenforo and would support any mods that do so. We used to use this in our VB4 site using custom profile fields.

Unrelated-ish, if someone is interested in creating the ability to show Source Dedicated Server info in Xenforo (map, players online etc) I would support such a mod as well.

I wasn't aware of this before but after looking through the group listings I've discovered any group with more than 150 members won't display game play statistics, which is a bit of a bummer.

In regards to "tighter integration", custom profile fields should allow for user cards and the like. For servers, theoretically I think it'd be possible to create your own banner already as something like your server ip isn't going to be changing (and the fact sites currently do track server stats). The problem is that, as far as I know, raw server data isn't outputted anywhere on the web, so I'm guessing they have pieces of kit that are somehow able to pull the data obtained from the in-game server lists for each game. If that is the case, I've no idea how to go about doing that.

If you wanted to simply display another site's server banner (eg. gametracker) on a page then that'd be simple enough, but I don't think that's what you're after?

ErrorException: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: URL file-access is disabled in the server configuration - library/GP/Steam/ControllerPublic/Index.php:13
I fixed this with a php.init with this on
allow_url_fopen = ON

Glad you've managed to solve this :). I've added it to the FAQ section in the second post in case any others have this issue as well.
 
I have the mod installed on my test site and it works very well. Thank you for it.

One little problem though, it is showing up spread out across the whole screen at the bottom of the forums. Im sure that I put everything as directed. Any thoughts on this and I can post a screenshot if needed. In the meantime I will tinker with it and try to persuade it, gently for now, to get back to the sidebar where I want it.
 
I got it to work now....;)

HTML:
<xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>

<xen:sidebar>

    <xen:edithint template="sidebar.css" />

    <xen:hook name="forum_list_sidebar">
        <xen:include template="sidebar_online_users" />
        <xen:include template="GP_Steam" />
        <!-- block: forum_stats -->
        <div class="section">

The opening post in this thread stated to place <xen:include template="GP_Steam" /> above the <xen:sidebar> line. It worked there but below my actual forum and not over in the sidebar. So I moved the line to where you see it now and it works just fine.
 
I've noticed that with this addon enabled there is a 1-2 second extra delay in loading the main forum listing.

This is because on each page load (with the sidebar of course) it is pulling information directly from the steam website before it generates the display. It's possible to cache this information in your addon (I've done this in a cron job and edited your Index.php in ControllerPublic) as it's probably not necessary to have a live update of the information if it causes a noticeable pause while viewing the forum :)
 
How easy can this work with xfrocks widget framework?

Very easy. I hope Gaming Perfection can do something like this

Listen to event widget_framework_ready (assuming he will use the callback GP_Steam_EventListener_Listener::widget_framework_ready), in that case Listener.php should look like this

PHP:
class GP_Steam_EventListener_Listener
{
    public static function listen($class, array &$extend)
    {
        /* the load_class_controller stuff goes here */
    }

    public static function widget_framework_ready(array &$renderers)
    {
        $renderers[] = 'GP_Steam_WidgetRenderer';
    }
}

Add one more file for the class GP_Steam_WidgetRenderer, WidgetRenderer.php should look like this

PHP:
<?php
class GP_Steam_WidgetRenderer extends WidgetFramework_WidgetRenderer_ForumListOnly_Abstract {
	protected function _getConfiguration() {
		return array('name' => '[Forum List Only] [GP] Steam Stats', 'useWrapper' => false);
	}
	public function parseOptionsInput(XenForo_Input $input, array $widget) {
		$options = XenForo_Application::get('options');
		$found = $options->GP_Steam_On_Off;
		if (empty($found)) {
			throw new XenForo_Exception(new XenForo_Phrase('wf_x_not_installed', array('target' => '[GP] Steam Stats')), true);
		}
		return parent::parseOptionsInput($input, $widget);
	}
	protected function _getRenderTemplate($templateName, array $params) {
		return 'GP_Steam';
	}
	protected function _render(array $widget, $templateName, array $params, XenForo_Template_Abstract $renderTemplateObject) {
		$renderTemplateObject->setParams($params);

		return $renderTemplateObject->render();		
	}
}

If this is installed into a XenForo system without Widget Framework, not harmful at all :)
 
Top Bottom