News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Advanced XFire Field v2.0

Started by Violat3r, April 19, 2008, 07:23:35 PM

Previous topic - Next topic

Violat3r

Advanced XFire Field Mod v2.0
by
Violat3r | Support | Link to Mod


Compatibility: This should work fine on SMF 1.1.4 through 1.1.7. But its only been tested on those so im not sure how well it will work with anything lower nor do i know about compatibility with 2.x Beta at this time.

Info: This mod will add an "XFire" field to your members' profile page, a little image in their posts, xfire information in the member list, and xfire info in the "Who's Online" page. Unlike the other xfire mods i've encountered, this one doesn't just display your xfire name and a link to your xfire profile. It shows your xfire information using the mini-profile Banners from the Xfire website. The small icon which appears on the member list, posts, and who's online list will change if their online, offline, or playing a game. If the game has an icon that XFire has setup, it will show that icon, if however your playing a game that XFire doesnt have an icon for but still recognizes the game, it will show the normal icon as well as what game their playing when you mouseover the icon.

Upgrading: If your upgrading from the 1.x versions, please, PLEASE delete ALL codes added with the xfire mod and COMPLETELY un-install it. Your database will keep the members' information so upon installation of the new versions, everything should work ok. If it doesnt...then well i guess they've got to reenter there information, sorry. The main reason for such deletion is almost ALL the code has been tweaked in some way. After this has been done, just follow the following installation instructions and you should be up and running in no time!

Installation: First off just Download the mod and then go to "Admin > Packages > Download Packages" then browse for the mod zip and click "Upload". Once thats done, click "Install Mod" then click "Apply Mod". It may pause for a few seconds but eventually you should get a successful installation. Kerblam! Its done, just go to "Profile Information" and enter your xfire Username. Your other option is to search for it in the package servers, but i dont much care for them so i prefer the manual installation method.

For Custom themes that have a Custom "Profile.template.php" and "Display.template.php", it wont be quite as simple:

You will need some kind of text editor or coding program to open the php files needed; If your theme has both a custom Profile.template.php and Display.template.php then please follow both instructions carefully, if your theme has only 1 of those custom-built please just follow the instructions for just that one (in most cases, custom themes dont have a custom Profile.template.php, but you MUST be sure else it wont work right).



FOR THE Profile.template.php:

Open Profile.template.php and locate the following code:
<td>', $context['member']['yim']['link_text'], '</td>

position your cursor directly after that code and then PASTE this next code:
</tr><tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr><tr><td><b>', $txt['xfire'], ': </b></td>
<td>', !empty($context['member']['options']['xfire']) ? '<a href="http://www.xfire.com/profile/' . $context['member']['options']['xfire'] . '/" target="_blank"><img src="http://miniprofile.xfire.com/bg/sh/type/1/' . $context['member']['options']['xfire'] . '.png" /></a><br /><div class="smalltext"><a href="xfire:add_friend?user=' . $context['member']['options']['xfire'] . '">' . $txt['xfire_add'] . '</a> | ' . $txt['xfire_dont'] . ' <a href="http://www.xfire.com/download/" target="_blank">' . $txt['xfire_download'] . '</a></div>'  : '', '</td><tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr>


Now in the same file, located the following code:
<td><input type="text" name="YIM" maxlength="32" size="24" value="', $context['member']['yim']['name'], '" /></td>

Once again, exactly after that code paste this:
</tr><tr><td><b>', $txt['xfire'], ': </b><div class="smalltext">', $txt['xfire_username'], '. </div></td>
<td><input type="text" name="default_options[xfire]" maxlength="25" size="24" value="', @$context['member']['options']['xfire'], '" /><br /><div class="smalltext">' . $txt['xfire_dont'] . ' <a href="http://www.xfire.com/download/" target="_blank">' . $txt['xfire_download'] . '</a></div></td>


Save the file and upload it to your theme directory. And your done with the Profile.template.php!! YAY!!



FOR THE Display.template.php:

Open Display.template.php and locate this code:
', $message['member']['yim']['link'],

Directly after that paste this code:

!empty($message['member']['options']['xfire']) ? '<a href="http://www.xfire.com/profile/' . $message['member']['options']['xfire'] . '/" target="_blank"><img src="http://miniprofile.xfire.com/bg/bg/type/4/' . $message['member']['options']['xfire'] . '.gif" width="16" height="16" alt="' . $message['member']['options']['xfire'] . '" title="' . $txt['xfire'] . ' :: '.$message['member']['options']['xfire'].'" /></a>' : '',

Make sure that you start the above code on a new line but keep this code after the xfire one on the next line:   '<br />';
Basically your display.template.php should look like this:
// This shows the popular messaging icons.
echo '
', $message['member']['icq']['link'], '
', $message['member']['msn']['link'], '
', $message['member']['aim']['link'], '
', $message['member']['yim']['link'],
!empty($message['member']['options']['xfire']) ? '<a href="http://www.xfire.com/profile/' . $message['member']['options']['xfire'] . '/" target="_blank"><img src="http://miniprofile.xfire.com/bg/bg/type/4/' . $message['member']['options']['xfire'] . '.gif" width="16" height="16" alt="' . $message['member']['options']['xfire'] . '" title="' . $txt['xfire'] . ' :: '.$message['member']['options']['xfire'].'" /></a>' : '',
'<br />';

Notice that the '<br />'; is on its own line AFTER the xfire modification.

Save the file and upload it to your theme directory. And your done with the Display.template.php!! YAY!!


if your still having some problems understanding EXACTLY what to do, try going Here, it will help explain what to do probably better then i can.

Un-install: To un-install this mod, just go to "Admin > Packages" and click "un-install" then delete if you just want to get rid of it completely. If its a custom theme that you made MANUAL changes to, just locate the codes i told you to paste above, and then delete them, CAREFULLY. You dont want to accidentally delete an important part of your forum. In this case you might consider making a copy of each of the template.php files BEFORE modifying them so that maybe at a later date you can just re-upload them as if nothing was installed to begin with.

IMPORTANT: ALWAYS, and i mean ALWAYS make a back of your forum, files, and database before installing any kind of mod.

Support: Please look for help and support in the mod's post in the SMF Community forums which you can find here. My website is currently non-operational, so you will not be able to contact me through there.

Future Releases:

  • I will first be working on getting it running on SMF v2.x series.
  • I will be working on a way to allow the member to choose a different banner from some kind of a dropdown list.
  • Since tsviewer.com's release of similar types of banners, im looking into making a mod similar to this one for the teamspeak banner.

Credits: Huge Credits go to InsaneBoarder234 for his great XFire Field mod that led to the eventual construction of this one. I would also like to thank winrules for his Custom Profile Field mod which gave me the idea of making something like this. And finally i would like to thank ccbtimewiz from the Community forums for finding such a simple mistake on my part and correcting it for me as well as providing a lot of help and support to my mod-users, especially when i was absent for months on end, Thanx!

Changelog:


  • April 19th: v1.0
       
    • Initial Release.

  • April 24th: v1.1
       
    • Added Support for several languages (and their UTF-8 equivalents):
              *Portuguese/Brazilian - Thanx joomlamz
              *British English
              *Spanish - Thanx Agustin
    • Added Support for the custom theme "Aa_New_Damage" by m3talc0re.
    • Added Support for the 2 other original SMF themes besides the default (i.e. Babylon and classic).
    • Moved the xfire image around to allow for a more "direct" extraction/installation.
    • Added a link to add them as a friend (it will open using XFire).

  • May 20th: v1.2
       
    • Added Support for the "Who's Online" List. For custom themes' users: This update changes none of the original code, so just un-install and delete, then upload and install v1.2 and your good to go.

  • December 17th: v2.0
       
    • Theres been a lot of code changed as well as additions and deletions so i decided to go ahead and bump this up to a v2.0 of the mod.
    • I've deleted all the theme support for the mod since it was just annoying clutter really.
    • There's no more xfire image on the post display; i've included the FULL code for the XFire's mini-profile information. Which grabs the image from xfire.com itself.
    • Made the "Add as Friend?" link use the "smalltext" css code so its smaller and looks better in contrast with the Banner.
    • Added text "Dont Have XFire? Get it Here!" that will link you to the XFire download page if you dont have it and are interested. It also adds the same text right
      under the field where you enter your XFire username in the edit profile area.
    • Added a "languages.xml" file so i could keep things organized by having the main modifications done in one area, and the text strings and translated text strings in a separate file, to be able to easily modify and or add new language translations. So if your looking to translate it into another language for me, just look in there!
    • Added Support for another language (and its UTF-8 equivalent):
              *Dutch - Thanx mrgekkie
    • FIX - The most annoying bug that i somehow completely overlooked on v1.x was the xfire field appearing no matter if you had an xfire username set up or not. I found this had happened because of the way i included the "Add as Friend?" link, this HAS been fixed and the XFire info panel will now ONLY appear when one has entered their username.
    • One of my original plans was to allow people to have a dropdown of where they can choose WHICH of the XFire mini-profile banners they want to show, but since is still currently beyond my coding abilities it will have to wait for a future release. As a consolation prize, i will be putting a small guide on the community forums in this mods' section on how to change it to the one you want.
  • December 28th: v2.0a
       
    • I quickly tossed up this version for those of you who use Nascar's Memberlist Xrevolution Mod for 1.1.7. Now he coded it very well and i got no errors when the regular version of this was installed along with the memberlist mod, so you'll only need to install this version if you want the XFire icon to show up in the new memberlist. Please make sure that you first un-install all previous versions of this mod (including the new 2.0 verson) before installing this one.

Sabre™

Good sh*t mate
About time someone did a good mod for xfire.
Its fantastic mate, thanks for the great work!

My custom theme edit for the display template gets a parse error.
It is the invazion theme, and I've added my display template for you to see why.
Hopefully you can sort this out.
Thank You in advance. :)
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


Apllicmz

nice Mod i translate portuguese

<file name="$languagedir/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['xfire'] = 'XFire';
$txt['xfire_username'] = 'O XFire do membro';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['xfire'] = 'XFire';
$txt['xfire_username'] = 'O XFire do membro';
]]></add>
</operation>
</file>



Violat3r

well its late so i shall make this brief, first off: Thanx joomlamz! I'll get to work on adding that in the next day or two. Second; Sabre, i dont know if you thought you had added the code to the display template and it wouldnt work, or if you were just giving me a fresh copy without the code added, but you have to add a certain code YOURSELF, to the display.template.php for ALL custom themes, as it will only install normally on the default theme. But in any case, please try this (i added the code for you) and let me know if it works:

Sabre™

#4
Hi mate.
Yep sorry, I didnt explain myself properly.
I had, as with every mod, manually installed this, but when adding the code supplied for that template, I would get the parse error.

Anyho..  Thank You for adding the code for me bud. It works flawlessly!!
Im about to compare both codes and see what differs.

Cheers :)

EDIT:   I found what I was doing wrong..   I was adding an extra single quote!! LOL
Cheers mate.   Glad you showed me that flaw.
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


Violat3r

I just updated the Mod to version 1.1, the changes can be seen in the "Changelog" located in the first post in this topic.

lOOmis

Have the mod set up and running on my site but the feilds in the profile are not right. I might have done something but believe I've followed the directions well. Here is an image of what Im talking about. I realize it deals with a table or something along those lines but I'm still lost, obviously. Any help would be great,

Thanks

Violat3r

Can you please post your profile.template.php? im sure that its just an issue with placement in there.

ccbtimewiz

Nice modification (and glad to help :P).

Though, only a couple more requests for this modification. Could you port it into the memberlist, buddylist, and who's online list?

I can do this myself obviously, but it would be nice to see a fully integrated modification. =)

Violat3r

Oh, i definitely plan to. Although right now im extremely busy with about a bazillion other things lol so changes will come relatively slowly.

lOOmis

Hey I got the MOD to work, looks great. I missed a line of code when copying it over to the custom Theme. Works like a champ now. Thanks anyway Violat3r. Nice MOD.

Violat3r

Just updated the mod to show up on the "Who's Online" list! Huzzah! =D

malfunkshun

#12
Problem, my code for default/display template is

', $message['member']['icq']['link'], '
', $message['member']['msn']['link'], '
', $message['member']['aim']['link'], '
', $message['member']['yim']['link'], '<br />';

This is the excerpt from the default, unchanged display.template.
the code insert doesnt work, T String error :(...any ideas? perhaps its because its late but I cant get my head around it lol

ccbtimewiz

Show me more code. WITH the code from the mod inserted.

malfunkshun


// This shows the popular messaging icons.
echo '

', $message['member']['icq']['link'], '
', $message['member']['msn']['link'], '
', $message['member']['aim']['link'], '
', $message['member']['yim']['link'], '
!empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/' . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="'.$message['member']['options']['xfire'].'"></a>' : '',<br />';

// Show the profile, website, email address, and personal message buttons.

including the line for insertion as per the install instructions.
resulting in Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in ... on the added line.

ccbtimewiz

Use this instead:

// This shows the popular messaging icons.
echo '
', $message['member']['icq']['link'], '
', $message['member']['msn']['link'], '
', $message['member']['aim']['link'], '
', $message['member']['yim']['link'], ''

!empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/' . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="' , $message['member']['options']['xfire'].'"></a>' : '' , '<br />';

malfunkshun

Quote
Parse error: syntax error, unexpected '!', expecting ',' or ';' in .../Themes/default2/Display.template.php on line 338

329:                         ', $message['member']['blurb'], '<br />
330:                         <br />';
331:
332: // This shows the popular messaging icons.
333: echo '
334: ', $message['member']['icq']['link'], '
335: ', $message['member']['msn']['link'], '
336: ', $message['member']['aim']['link'], '
337: ', $message['member']['yim']['link'], ''
338: !empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/'; . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="' , $message['member']['options']['xfire'].'"></a>' : '' , '<br />';
339:             
340:    
:( unfortunately that didnt work either. Thanks for trying though.

malfunkshun

Ahh, its surprising how much some sleep can help.
Since I am using the default code I am surprised that no-one else has had this problem (1.1.5), on the off chance that someone does the working code is below;

// This shows the popular messaging icons.
echo '
', $message['member']['icq']['link'], '
', $message['member']['msn']['link'], '
', $message['member']['yim']['link'], '
', $message['member']['aim']['link'], ' ',
!empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/' . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="'.$message['member']['options']['xfire'].'"></a>' : '','<br />';

ccbtimewiz

Quote from: malfunkshun on June 11, 2008, 02:49:30 PM
Quote
Parse error: syntax error, unexpected '!', expecting ',' or ';' in .../Themes/default2/Display.template.php on line 338

329:                         ', $message['member']['blurb'], '<br />
330:                         <br />';
331:
332: // This shows the popular messaging icons.
333: echo '
334: ', $message['member']['icq']['link'], '
335: ', $message['member']['msn']['link'], '
336: ', $message['member']['aim']['link'], '
337: ', $message['member']['yim']['link'], ''
338: !empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/'; . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="' , $message['member']['options']['xfire'].'"></a>' : '' , '<br />';
339:             
340:    
:( unfortunately that didnt work either. Thanks for trying though.

[code338: !empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/'; . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="' , $message['member']['options']['xfire'].'"></a>' : '' , '<br />';[/code]

Change to

echo ',!empty($message['member']['options']['xfire']) ? '<a href="http://profile.xfire.com/' . $message['member']['options']['xfire'] . '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/xfire.gif" alt="' . $message['member']['options']['xfire'] . '" title="' , $message['member']['options']['xfire'].'"></a>' : '' , '<br />';

CrazyHorse80

I got this error in forum log:

Quote8: Undefined index: xfire
File: D:\xx\xx\forum\Themes\default\languages\Who.italian.php (eval?)
Riga: 225

I looked into the mod file and it seems it desn't modify who.english.php so I don't expect to make any change in my who.italian.php: what's wrong?
Bye,
PS

Advertisement: