• 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.

Steam Identity Service

Status
Not open for further replies.
Added a version compatible with XF 1.1 using the new custom profile fields system along with improved validation and the same profile link display as before. Should be a seamless update over the previous version but dependant addons (e.g. steam openid login) will need updated
 
Just tried to install this on a fresh installation of 1.1 B2 and get the following error on import:

  • The requested field could not be found.
  • Please enter a valid field ID.
Prior to that, I got a different error, something about a missing callback or invalid callback, when I tried it again to capture the error message for you, I got the above error message.
 
Just tried to install this on a fresh installation of 1.1 B2 and get the following error on import:

  • The requested field could not be found.
  • Please enter a valid field ID.

Same here. The problem is the installer assumes the Steam custom userfield to already exist, and does not create it if it does not.

Here's how to set it up manually:

steam1.webp
steam2.webp
steam3.webp
 
Thank ya much! I'll have to give this a shot when I get home from work, but appreciate you taking the time to figure it out and post the fix!
 
I'm using XenForo 1.0.4 and I'm getting Fatal error: Call to undefined method WidgetFramework_Extend_DataWriter_User::setCustomFields() in /home/blackhea/public_html/library/Dark/SteamLogin/ControllerPublic/Kyouko.php on line 167 when trying to assoate an account
 
Install the Steam Identity Service:
http://xenforo.com/community/threads/steam-identity-service.9819/#post-140629

open up XenForo_ControllerPublic_Thread (library/XenForo/ControllerPublic/Thread.php) and after line ~69..
PHP:
$posts = $postModel->getAndMergeAttachmentsIntoPosts($posts);
add...
PHP:
/* TerminalAddict WAS HERE */
foreach ($posts as $key => $post)
{
    $posts[$key]['identities'] = unserialize($post['identities']);
}
/* END TerminalAddict WAS HERE */

in message_user_info add:
Code:
<xen:hook name="message_user_identities" params="{xen:array 'user={$user}'}">
    <xen:foreach loop="{$user.identities}" key="$service1" value="$account1">
    <xen:if is="{$service1} == 'Steam'">
        <div class="steamprofile" title="{$account1}"></div>
    </xen:if>
    </xen:foreach>
    <xen:if is="!in_array('Steam', {$user.identities})">
        <div class="steamprofileNOT" title="No Steam"> &nbsp; <a href="account/contact-details">NO SteamID entered</a></div>
    </xen:if>
    </xen:hook>

in PAGE_CONTAINER just before </head>
add:
HTML:
<script type="text/javascript" src="/steamprofile/steamprofile.js"></script>

example:
http://www.fps.net.nz/community/threads/hello.1485/

steam badges on each "post bit"

This seems to have broken in 1.1 - when attempting this I get:

ZRhpH.png


I've got all the required files and such, followed all the instructions. Any ideas?
 
Just as an FYI, but this doesn't work on 1.1b2, due to the removal of the identities column from the user_profile table. That has been replaced with a new custom_fields column. I'll see if I can figure out how to get this working :)

Just noticed your post related to the error I posted above, you didn't by chance have any luck getting it to work with 1.1 did you? Since you didn't post a follow up I'll presume not :(
 
Just noticed your post related to the error I posted above, you didn't by chance have any luck getting it to work with 1.1 did you? Since you didn't post a follow up I'll presume not :(

I totally forgot about this. Not yet, no. I am having an issue reading out the proper values in the template :(
 
Ok, I think I got an idea of what is happening.

First all you have to go to the Users >> Custom Fields select Steam and go in General Options. You have to make sure that the content is Visible in User Info in Messages. This makes sure that the content gets correctly carried over to the default template. The output will be:

steam_raw_data.webp

As you can see the Steam ID is there in raw form and it is a clickable URL.

What I can see in the template is that the whole process goes through a helper:

HTML:
<dl class="pairsInline userField_{$fieldId}">
  <dt>{xen:helper userFieldTitle, $fieldId}:</dt>
  <dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
</dl>

So, Xenforo calls for a Helper for userFieldValue (the type passed is of $fieldInfo) and then prints something, in this case a URL. But the URL is in the wrong format, since it seems that Steams uses a different schema: http://steamcommunity.com/profiles/{digits}.

That aside, I believe that by simply writing the correct helper, without touching the main corpus of Xenforo or the standard templates, we should be able to reactivate the functionality in 1.1.
 
Ok! Got it! We can piggy back on the helper already in the Steam Identity Service. Let me work a bit on it (after I watch Terranova, that is ;) )
 
This works only with 1.1b4 (dunno about the other betas, won't work with 1.0.x)

Ok, step one:

Change the content of file library/Dark/Steam/EventListener/TemplatePostRender.php to the following code:

PHP:
class Dark_Steam_EventListener_TemplatePostRender
{
        static public function listen($templateName, &$output, &$containerData, XenForo_Template_Abstract $template){
                if($templateName == 'member_view'){
 
                        $output = preg_replace_callback('#(<a href="http://steamcommunity.com/profiles/)([^"]+)(">.*?</a>)#', array('Dark_Steam_EventListener_TemplatePostRender', 'profileReplace'), $output);
 
                }
       
                if($templateName == 'thread_view'){
 
                        $output = preg_replace_callback('#(<a href="http://steamcommunity.com/profiles/)([^"]+)(">.*?</a>)#', array('Dark_Steam_EventListener_TemplatePostRender', 'profileReplace'), $output);
 
                }
 
       
        }
 
        static public function profileReplace($matches){
                return $matches[1].Dark_Steam_Helper_SteamUserField::steamIdToCommunityId(urldecode($matches[2])).$matches[3];
        }
}

This makes sure that the Steam link in the message_user_info of the user actually gets the correct link to the Steam system. From here it is an "easy" change to make sure that we can run the steamcommunity code to actually show the user's Steam Status.

Let me work some more...
 
Instructions to have a Steam Powered profile shown when reading messages in Xenforo 1.1b4.

Requirements:
- Get http://code.google.com/p/steamprofile/
- Set up Steam Identity Service (like it is show on the thread)

Steps:
  • Install steamprofile on your htdocs root
  • The directory steamprofile/cache needs to be writable (chmod 777 or chown www-data:www-data or whatever) (Use FACL if your system supports it!)
  • The template PAGE_CONTAINER just before </head> add:
HTML:
<script type="text/javascript" src="/steamprofile/steamprofile.js"></script>
  • Then all you have to go to the Users >> Custom Fields select Steam and go in General Options. You have to make sure that the content is Visible in User Info in Messages. This makes sure that the content gets correctly carried over to the default template.
  • Change the content of file library/Dark/Steam/EventListener/TemplatePostRender.php to the following code:
PHP:
class Dark_Steam_EventListener_TemplatePostRender
{
    static public function listen($templateName, &$output, &$containerData, XenForo_Template_Abstract $template){
        if($templateName == 'member_view'){
         
            $output = preg_replace_callback('#(<a href="http://steamcommunity.com/profiles/)([^"]+)(">.*?</a>)#', array('Dark_Steam_EventListener_TemplatePostRender', 'profileReplace'), $output);
         
        }
        if($templateName == 'thread_view'){
 
            $output = preg_replace_callback('#(<a href="http://steamcommunity.com/profiles/)([^"]+)(">.*?</a>)#', array('Dark_Steam_EventListener_TemplatePostRender', 'profileSteamView'), $output);
         
        }
    }
 
    static public function profileReplace($matches){
        return $matches[1].Dark_Steam_Helper_SteamUserField::steamIdToCommunityId(urldecode($matches[2])).$matches[3];
    }
 
    static public function profileSteamView($matches){
        return "<div class=\"steamprofile\" title=\"".Dark_Steam_Helper_SteamUserField::steamIdToCommunityId(urldecode($matches[2]))."\"></div>";
    }
}
  • Replace the .steamprofile CSS tag in file steamprofile/theme/default/style.css with:
HTML:
.steamprofile {
        position: relative;
        width: 109px;
        height: 48px;
        background: #3A3A3A url(background.png);
        overflow: hidden;
        margin: 4px;
}

And there you have it! With Xenforo 1.1b4 works like a charm and you don't need to do much, other then to work on the PACE_CONTAINER template. And I believe that we can work around that as well, but I don't have the time tonight. You can see the end result here: http://www.eqnomadi.org/forum/threads/nuova-casa.4073/ Garani is either online or off-line.
 
Status
Not open for further replies.
Top Bottom