Thread: Profile Enhancements - Xbox Live Recent Games in Profile Tab
View Single Post
  #49  
Old 04-13-2009, 02:25 AM
Gamelobby's Avatar
Gamelobby Gamelobby is offline
 
Join Date: Jul 2007
Location: Long Beach, CA
Posts: 997
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TigerC10 View Post
To disable the tab from displaying for people that don't have the XBox Live service, you just need to change some of the plugin code.

For the simple fix, change the first line of your plugin Xbox Live Info Tab (it's at the member_build_blocks_start hook) code to:
Code:
if ( $vbulletin->options['xblinfo_enable_product'] AND $this->profile->userinfo[ $vbulletin->options['xblinfo_fieldid'] ] )
{
Altered code is in red. It's not the most efficient code, but it should work fine.
It screwed up my profile.. and still no tab. (it made all the font on the site much bigger.)
It actually screwed up my profile worse than others because of my photobucket slide show mod, but it still screwed up other profile too.

Also there is this error code across the top of the site now..
Code:
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/content/m/i/l/milo327/html/Forum/member.php(463) : eval()'d code on line 1
Any other thoughts..?


Here is the full xml
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="xblinfo_tab" active="1">	<title>Xbox Live Info tab in Profile</title>	<description>Adds Xbox Live recent games list in user profile tab.</description>	<version>1.2</version>	<url>https://vborg.vbsupport.ru/showthread.php?t=196843</url>	<versioncheckurl />	<dependencies>		<dependency dependencytype="php" minversion="5" maxversion="" />	</dependencies>	<codes>	</codes>	<templates>		<template name="memberinfo_block_xblinfo" templatetype="template" date="1227759456" username="Dudditz" version="1.2"><![CDATA[<div class="alt1 block_row">
	<ul class="list_no_decoration">
		$block_data[xblinfo]
	</ul>
</div>]]></template>	</templates>	<plugins>		<plugin active="0" executionorder="5">			<title>Templates Cache</title>			<hookname>cache_templates</hookname>			<phpcode><![CDATA[$globaltemplates[] = 'memberinfo_block_xblinfo';]]></phpcode>		</plugin>		<plugin active="1" executionorder="5">			<title>Xbox Live Info Tab</title>			<hookname>member_build_blocks_start</hookname>			<phpcode><![CDATA[if ($vbulletin->options['xblinfo_enable_product'])
{
error_reporting(0);
	if(empty($vbulletin->options['xblinfo_tabtitle']))
	{
		$xblinfo_tabtitle = 'Xbox Live Games'; 
	}else{
		$xblinfo_tabtitle = $vbulletin->options['xblinfo_tabtitle'];
	}
$blocklist = array_merge($blocklist, array(
		'xblinfo' => array(
			'class' => 'xblinfo',
			'title' => $xblinfo_tabtitle,
			'hook_location' => ($vbulletin->options['xblinfo_tab_location']==0) ? 'profile_left_first' : 'profile_left_last'
		)
	));

	class vB_ProfileBlock_xblinfo extends vB_ProfileBlock
	{
		var $template_name = 'memberinfo_block_xblinfo';
		function confirm_empty_wrap()
		{
			return false;
		}

		function confirm_display()
		{
			return ($this->block_data['xblinfo'] != '');
		}

		function prepare_output($id = '', $options = array())
		{   global $vbulletin;
			$pmgc_gamertag = '';
			$xblupf = $vbulletin->options['xblinfo_fieldid'];
			$pmgc_gamertag = $this->profile->userinfo[$xblupf];
			if ($pmgc_gamertag=='') {
                        $pmgc_xbl_content='No Gamertag on file.<br /><a href="profile.php?do=editprofile">Add your gamertag here</a>';
                        $this->block_data['xblinfo'] = $pmgc_xbl_content;
			}else{
			
			$getnew = true;
			$pmgc_newtag = strtolower($pmgc_gamertag);
			$pmgc_newtag = ereg_replace(" ", "+", $pmgc_newtag);
			$gamerxml = ereg_replace(" ", "%20", $pmgc_gamertag);
			$url = "http://duncanmackenzie.net/services/GetXboxInfo.aspx?GamerTag=" . $gamerxml;
			$file = "".$pmgc_newtag."_xbox.xml";
			$path = $vbulletin->options['xblinfo_cache_dir']."/";
			if (!is_dir($path)) {  return; }else{

			$filetime = @filemtime($path.$file);
			$time = time();
			$difference = ($time - $filetime);
			if (file_exists($path.$file))
			{
				$filetime = @filemtime($path.$file);
				$time = time();
				$difference = ($time - $filetime);
				if ($difference < 60)
				{
					$getnew = false;
				}
			}
			$pmgc_xbl_content = '';
			//update temp file with live xml data
			if ($getnew === true)
			{
			 $fp = fopen($path.$file, "w+");
			 $ch = curl_init();
			 curl_setopt($ch, CURLOPT_FILE, $fp);
			 curl_setopt($ch, CURLOPT_URL, $url);		
			 curl_setopt($ch, CURLOPT_HEADER, false);
			 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
			 curl_exec($ch); 	// get data from url and dump to file
			 curl_close($ch);
			 fclose($fp);
			}
			if (file_exists($path.$file))
			{
			 $xml = simplexml_load_file($path.$file);

			 $pmgc_xbl_content = '<table width="100%" cellpadding="5" cellspacing="5" style="border: 1px solid"><tr><td valign="top"><img src="' . $xml->TileUrl . '"></td><td align="left" valign="top" nowrap><b>' . $xml->Gamertag . '</b><br> <br>Reputation:<br><img src="' . $xml->ReputationImageUrl . '"></td><td align="left" valign="top" width="100%">Gamer Score: ' . $xml->GamerScore . '<br> <br>Zone: ' . $xml->Zone . '</td></tr><tr><td><b>' . $xml->PresenceInfo->StatusText . '</b></td><td colspan=2><b>' . $xml->PresenceInfo->Info . '</b></td></tr></table>';
			if ($xml->State == "Valid") {
		    foreach ($xml->RecentGames->XboxUserGameInfo as $games)
				{
				 $pmgc_xbl_content .= '<br><table width="100%" cellpadding="5" cellspacing="5" style="border: 1px solid"><tr><td valign="top"><img src="' . $games->Game->Image64Url . '"></td><td align="left" valign="top" width="100%"><b>' . $games->Game->Name . '</b><br> <br>Achievements: ' . $games->Achievements . ' of ' . $games->Game->TotalAchievements . ' possible.<br> <br>Gamer Score: ' . $games->GamerScore . ' of ' . $games->Game->TotalGamerScore . ' possible.</td></tr></table>';
				}
			}else{unlink($path.$file);}
			$pmgc_xbl_content .= "<br><div align=\"center\" class=\"smallfont\">provided by <a target=\"_blank\" href=\"http://www.pimpmygamercard.com\"><b>PimpMyGamercard</b></a></div>";
			}
			            $this->block_data['xblinfo'] = $pmgc_xbl_content;
						}
		}
	}
}
}]]></phpcode>		</plugin>	</plugins>	<phrases>		<phrasetype name="GLOBAL" fieldname="global">			<phrase name="xblinfo_xblinfo" date="0" username="" version=""><![CDATA[Xbox Live Info]]></phrase>		</phrasetype>		<phrasetype name="vBulletin Settings" fieldname="vbsettings">			<phrase name="setting_xblinfo_cache_dir_desc" date="1227758607" username="Administrator" version="1.1"><![CDATA[Please enter a folder, to which the xml files should be stored <br />(Please no slash (/) at the begining or the end)]]></phrase>			<phrase name="setting_xblinfo_cache_dir_title" date="1227758607" username="Administrator" version="1.1"><![CDATA[Cache Folder]]></phrase>			<phrase name="setting_xblinfo_enable_product_desc" date="1227758504" username="Administrator" version="1.1"><![CDATA[Select Yes to turn enable product]]></phrase>			<phrase name="setting_xblinfo_enable_product_title" date="1227758504" username="Administrator" version="1.1"><![CDATA[Enable Product]]></phrase>			<phrase name="setting_xblinfo_fieldid_desc" date="0" username="Dudditz" version="1.0"><![CDATA[If you have my <a href="https://vborg.vbsupport.ru/showthread.php?t=196587" target="_blank">Gamefields Icons Userfields</a> Product installed, leave this setting at <b>gf_xbox</b><br />OR you may use your own user profile field<br />Example: If your gamertag field id is 5, enter <b>field5</b> ]]></phrase>			<phrase name="setting_xblinfo_fieldid_title" date="0" username="Dudditz" version="1.0"><![CDATA[User Field]]></phrase>			<phrase name="setting_xblinfo_tab_location_desc" date="1227758487" username="Administrator" version="1.1"><![CDATA[Please select hook location]]></phrase>			<phrase name="setting_xblinfo_tab_location_title" date="1227758487" username="Administrator" version="1.1"><![CDATA[Profile Tab Hook location]]></phrase>			<phrase name="setting_xblinfo_tabtitle_desc" date="1227758579" username="Administrator" version="1.1"><![CDATA[You can set your own title for the profile tab here.]]></phrase>			<phrase name="setting_xblinfo_tabtitle_title" date="1227758579" username="Administrator" version="1.1"><![CDATA[Change the profile tab title]]></phrase>			<phrase name="settinggroup_xblinfo_group" date="0" username="Dudditz" version="1.0"><![CDATA[Xbox Live Info Tab]]></phrase>		</phrasetype>	</phrases>	<options>		<settinggroup name="xblinfo_group" displayorder="65535">			<setting varname="xblinfo_enable_product" displayorder="5">				<datatype>boolean</datatype>				<optioncode>yesno</optioncode>				<defaultvalue>0</defaultvalue>			</setting>			<setting varname="xblinfo_tab_location" displayorder="10">				<datatype>free</datatype>				<optioncode><![CDATA[select:piped
0|$template_hook[profile_left_first]
1|$template_hook[profile_left_last]]]></optioncode>				<defaultvalue>0</defaultvalue>			</setting>			<setting varname="xblinfo_tabtitle" displayorder="15">				<datatype>free</datatype>				<defaultvalue>Xbox Live Games</defaultvalue>			</setting>			<setting varname="xblinfo_cache_dir" displayorder="30">				<datatype>free</datatype>				<validationcode><![CDATA[return (is_dir(DIR . '/' . $data . '/'));]]></validationcode>				<defaultvalue>xblcache</defaultvalue>			</setting>			<setting varname="xblinfo_fieldid" displayorder="40">				<datatype>free</datatype>				<defaultvalue>gf_xbox</defaultvalue>			</setting>		</settinggroup>	</options>	<helptopics>	</helptopics>	<cronentries>	</cronentries>	<faqentries>	</faqentries>	<templateedits>	</templateedits></product>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01200 seconds
  • Memory Usage 1,837KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete