• 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.
Da Vinci, my hero. Excellent job! Thanks so much for the fix, hopefully it doesn't break with future betas :D
 
Well, I made a better .steamprofile CSS for my site. This time it wraps better.

HTML:
.steamprofile {
        position: relative;
        width: 118px;
        height: 100px;
        background: #3A3A3A url(background.png);
        overflow: hidden;
        margin-top: 4px;
        margin-bottom: 4px;
        margin-left: -4px;
}
 
Instructions to have a Steam Powered profile shown when reading messages in Xenforo 1.1b4.


Well, I did a bit more work on the look and feel. I have added the borders as with the Xenforo avatar picture, and made sure that there is ample space below. The effect is that the Steam Profile now has a feel of being "embedded" and not just being slapped there. The change is a bit more then just a CSS update.

In the CSS you should replace the .steamprofile class and add a new class: .spdark-wrap:
HTML:
.spdark-wrap {
        position: relative;
        width: 112px;
        height: 100px;
        background-color: #F0E0D2;
        border: 1px solid #E4BFA5;
        border-radius: 4px 4px 4px 4px;
        padding: 2px;
        overflow: hidden;
        margin-top: 4px;
        margin-bottom: 4px;
        margin-left: -4px;
}

.steamprofile {
        position: relative;
        width: 112px;
        height: 100px;
        background: #3A3A3A url(background.png);
        overflow: hidden;
}

As you can see, the .spdark-wrap colors are hardwired. I didn't manage to piggy back on Xenforo's color pallet, yet, sorry.

Then you have to modify the PHP code in library/Dark/Steam/EventListener/TemplatePostRender.php:

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=\"spdark-wrap\"><div class=\"steamprofile\" title=\"".Dark_Steam_Helper_SteamUserField::steamIdToCommunityId(urldecode($matches[2]))."\"></div></div>";
        }
}


Now you have a Steam Profile and is embedded within the Avatar's border and background style
 
This is good stuff, can you wrap all of the changes up into a single post/document? Doesn't have to be an add-on (would be nice), but isn't necessary. Just a clean list of instructions =)
 
do you make your own addon fot this ;)

Sorry mate, but I didn't quite catch that! :)

can you wrap all of the changes up into a single post/document?

Page 3, end of page, you have all instructions to make it work on xenforo 1.1b4. The other CSS on this page are just "cosmetical" changes. Plus I feel that if DarkImmortal feels that all these changes should be pulled in the main line, he'll do it. One thing that would be useful is an admin switch to activate or not the Steam Profile, just to make sure that if one wants the Steam IDs, but not the Steam Profile, the profile doesn't get it imposed to the admin.
 
Not sure if this would be the place to ask, as I'm presuming the issue here has something to do with params within my template, or lack thereof, but basically here's what I have going on:

I have an addon that takes care of basic templateHook/Create's, and one of the listeners adds a custom template bar to the top of all posts, called plague_message_bar.

PHP:
            case 'plague_bar_hook'; // Add content above all noticies / top of message posts
            {
                $mergedParams = array_merge($template->getParams(), $hookParams);
                $myTemplate = $template->create('plague_message_bar', $mergedParams);
                $rendered = $myTemplate->render();
                $contents = $rendered . $contents;
                break;
            } //end case

Within this template, whenever $user is called, I have to change it to $message. I am aware I can change the listener so that I don't have to do this, and there's no real reason why I haven't other than the alternative is simply more code and I'd probably have to pinpoint the params I'd want to manually hook...

At any rate, my issue is the steam badges appear in thread views within the plague_message_bar, but not within conversation views. On conversations it just shows the SteamID as a link, no badge.

Steam code within plague_message_bar:

Code:
<xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
    <xen:if is="{$fieldInfo.viewable_message}">
        <xen:if hascontent="true">
            <xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $message, {$message.customFields.{$fieldId}}}</xen:contentcheck>
        </xen:if>
    </xen:if>
</xen:foreach>

^ As you can see, $user was changed to $message

Screenshots:

Thread View:
QPJbx.png


Conversation view:
OKeyW.png


It's obvious conversation can still pull the correct data, it just seems as if the template isn't able to pull the CSS / images for the badges for some reason. I have the required js included:

<script type="text/javascript" src="/steamprofile/steamprofile.js"></script>

That's within the head of the page_container. Doesn't seem to be an issue with my listener / template using $message, etc, as it does pull the correct steam data... just not sure why the badges aren't showing.

Could the listener/template cause it to pull the wrong field or data for the steam ID in a dif template? e.g. in thread it pulls the 64 ID for the {$value} but in conversation it doesn't, or can't for some reason, and instead just uses the regular SteamID, but regular steamID for {$value} won't work, thus it creates a broken link in the conversation view, even though it displays the correct Steam ID... that was a boat load of speculation right there.

If anyone has any ideas or could point me in the right direction, either with my listener or other I'd appreciate it, thanks!
 
Still having issues with this regardless of whether it's required or not. I typed in the following ID:

STEAM_0:1:2660 which is one of mine. It doesn't like it. Why is this?
 
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.

Was anyone ever able to get this to work on 1.1 stable? Doesn't work for me at all :(.
 
Dark, you should def make an xbox live version of this :) would be sick.

UPDATE:

This worked like a charm with 1.1 (including the nice css addons mentioned above by da vinci) Im really happy right now haha
 
I AM SO DUMB.

Seriously. I created a new installation and installed this but I had the same issues as everyone else, but I used the instructions on how to create the user profile field and FORGOT to install the addon again, LOL!

Oh boy...
 
I just tried this plugin on 1.1 stable.

When I check Viewable on profile pages, the link is missing the value.

http://steamcommunity.com/profiles/

is supposed to be

http://steamcommunity.com/profiles/12345

The text of the link is fine, so I tried changing $valueUrl to $value, but it still doesn't add the steamid at the end of the link.

HTML:
<a href="http://steamcommunity.com/profiles/{$value}">{$value}</a>

Update

Looks like I found a bug in Xenforo. If you put a space between {$value}" and > then it shows up.
 
Status
Not open for further replies.
Top Bottom