Page 1 of 1

Xbox Live Gamertag

PostPosted: Tue Feb 13, 2007 7:19 am
Author: Pogue Moran
Your phpBB Version: 2.0.22
phpBB Type: Standard phpBB
MODs: Yes
Your knowledge: Beginner
Board URL: [url]http://[/url]

PHP Version:
MySQL Version:


What was done before the problem appeared?



What was done to try to solve the problem?




De.scription and Message

This isn't exactly fully my code I remember getting it off the phpbb site but I modified it a bit to work with PCP.
Please note I haven't had a chance to try this with Integramod yet as some things in PCP have changed in IM that I haven't checked out yet. This was done for PHPbb plus with PCP installed.

Anyway here are the additions:

In Def_userfuncs_custom.php add before ?>
Code: Select all
//----------------------------------- // //  Xbox Gamertag // //----------------------------------- function pcp_output_gamertag($field_name, $view_userdata, $map_name='') {    global $board_config, $phpbb_root_path, $phpEx, $images, $userdata;    global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;      $txt = '';    $img = '';    $res = '';    $gamertag = '';    $sendmessage = '';    $addgamer = '';           $gamertag = ( $view_userdata['user_gamertag'] && $view_userdata['user_id'] != ANONYMOUS ) ? '<iframe>' . $view_userdata['user_gamertag'] . '</iframe>' : '';;                $sendmessage = ( $view_userdata['user_gamertag'] && $view_userdata['user_id'] != ANONYMOUS ) ? '<a><img>'  : '';;                $addgamer = ( $view_userdata['user_gamertag'] && $view_userdata['user_id'] != ANONYMOUS ) ? '<a><img>'  : '';;  if ( $view_userdata['user_id'] != ANONYMOUS )    {                $img = $gamertag . '<br>' . $addgamer . ' ' . $sendmessage;    }       // result       $res = pcp_output_format($field_name, $txt, $img, $map_name);    return $res; }


What this above code will show is the xbox gamertag from the xbox site that links your last few games played as well as the gamerscore and etc. Also it will show buttons for sending a friend request through the xbox site and a message to the gamer. This part above will be used for the profile.

If you dont want the buttons with the friends request and message link then add the below code instead to def_userfuncs_custom.php. I use both.
Code: Select all
//----------------------------------- // //  Xbox Gamertag // //----------------------------------- function pcp_output_gamertagt($field_name, $view_userdata, $map_name='') {    global $board_config, $phpbb_root_path, $phpEx, $images, $userdata;    global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;      $txt = '';    $img = '';    $res = '';   if ( $view_userdata['user_id'] != ANONYMOUS ) {           $img = ( $view_userdata['user_gamertag'] && $view_userdata['user_id'] != ANONYMOUS ) ? '<iframe>' . $view_userdata['user_gamertag'] . '</iframe>' : '';;        }       // result       $res = pcp_output_format($field_name, $txt, $img, $map_name);    return $res; }


I use the above code for viewtopic and the previous one for the profile view anyone with more experience can help clean this up so you don't need two separate entries in the def_userfuncs_custom.php.

in def_userfields.php
Code: Select all
FIND:      'user_gender' => array(         'lang_key'     => 'Gender',         'class'        => 'real',         'type'         => 'TINYINT',         'dsp_func'     => 'pcp_output_gender',         'get_mode'     => 'LIST_RADIO',         'values'       => 'list_gender',     ),Add After     'user_gamertag' => array(         'lang_key'     => 'Xbox Gamertag',         'class'        => 'real',         'type'         => 'VARCHAR'         ),  


In Def_usermaps.php note in the profile view you don't have to put the gamertag where I put it. I like it right under the user title in the avatar view section.
Code: Select all
Find 'PCP.viewprofile.base.avatar' => array(Find         'user_rank_title' => array(                 'txt'          => true,                 'img'          => true,                 'crlf'         => true,                 'style'        => '<span>%s</span>',             ),  ADD AFTER     'user_gamertag' => array(                 'leg'          => true,                 'txt'          => true,                 'img'          => true,                 'dsp_func'     => 'pcp_output_gamertag',                 ),  FIND     'PCP.viewprofile.base.real' => array(  FIND    'user_occ' => array(                 'leg'          => true,                 'txt'          => true,             ),ADD AFTER     'user_gamertag' => array(                 'leg'          => true,                 'txt'          => true,                 ),FIND 'PCP.profil.profile_prefer.base.Real_info' => array(  FIND    'user_occ' => array(                 'input_id'     => 'occupation',                 'user_only'    => true,             ),  ADD AFTER       'user_gamertag' => array(                             'input_id'     => 'Xbox Gamertag',                       'user_only'    => true,     ),  FIND 'PCP.buddy' => array(FIND 'username' => array(                 'dsp_func'     => 'pcp_output_username_linked',                 'lang_key'     => 'Username',                 'ind'          => '2',                 'rqd'          => true,             ),ADD AFTER   'user_gamertag' => array(                 'ind'          => '28',                 'lang_key'     => 'Gamertag',             ),FIND     'PHPBB.viewtopic.left' => array(  You can add the following anywhere in the viewtopic left array       'user_gamertag' => array(                 'class'        => 'generic',                 'type'         => 'VARCHAR',                 'dsp_func'     => 'pcp_output_gamertagt',                 'img'          => true,                 'style'        => '<div>%s</div>',             ),            


Please note if you were using only the first code the dsp_func in viewtopic.left would be set to pcp_output_gamertag

[url=http]You can get the images mentioned in the above code here:[/url]

Also add the following to your phpbb_users table of your database

Field: user_gamertag Type: varchar Length: 25 NULL Default: NULL

Re: Xbox Live Gamertag

PostPosted: Sun Jul 01, 2007 11:29 am
Author: Taegost
Just so everyone knows, this code works perfectly under 1.4.0, I have it up and running on my site by copy/pasting everything exactly as it is here.
Thanks for this code, it's greatly appreciated!

PostPosted: Tue Sep 18, 2007 3:22 am
Author: zenrei
works great in 141 too!

my members LOVE it!