https://www.icyphoenix.com/viewtopic.php?f=35&t=5444 ----------------------------------- n1cks21 Tue 10 Feb, 2009 18:52 SOLVED - User Block Mod ----------------------------------- Not sure what I am trying to achieve is possible, I want to replace the avatar pic in the User Block with an image however the url for the image will include {memberrow.custom_fields.CUSTOM_FIELD} I have had a look at the block but got really confused :( :( :( any help ??? :( :( ----------------------------------- Limun Fri 13 Feb, 2009 16:30 Re: User Block Mod ----------------------------------- are we talking about this user block? [img]http://www.icyphoenix.com/files/images/3336/user_block_alt.png[/img] what you want to do exactly ? ----------------------------------- n1cks21 Sat 14 Feb, 2009 00:43 Re: User Block Mod ----------------------------------- [quote user="Limun" post="36584"]are we talking about this user block? [img]http://www.icyphoenix.com/files/images/3336/user_block_alt.png[/img] what you want to do exactly ?[/quote] Yes thats the block, when a user logs in instead of showing there avatar picture I would like to diaplay an image from this url:- "http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png" I think that {memberrow.custom_fields.CUSTOM_FIELD} is the Custom Profile Field I set. this is the image that would be displayed if I signed in [img]http://avatar.xboxlive.com/avatar/n1cks21/avatar-body.png[/img] which is "http://avatar.xboxlive.com/avatar/n1cks21/avatar-body.png" hope thats make sense ----------------------------------- spydie Sat 14 Feb, 2009 00:48 Re: User Block Mod ----------------------------------- youve got 2 possibilitys. you can upload the avatar to your site or you enable gravatar and put the link to your avatar on your personal profil avatar managment ----------------------------------- Limun Sat 14 Feb, 2009 01:12 Re: User Block Mod ----------------------------------- you can try like this [spoiler]

{U_NAME_LINK}
{LAST_VISIT_DATE}
{L_NEW_SEARCH}

{L_USERNAME}:

{L_PASSWORD}:


 {L_REMEMBER_ME}



{L_SEND_PASSWORD}

{L_REGISTER_NEW_ACCOUNT}
[/spoiler] but i m not sure if its gona work because i dont know what did you add in Custom Profile Field and i m not sure about this link [code linenumbers=false]http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png [/code] well try then we gona see :? ----------------------------------- n1cks21 Sat 14 Feb, 2009 04:05 Re: User Block Mod ----------------------------------- No It Didnt work :( when I clicked on the image link it was "http://avatar.xboxlive.com/avatar//avatar-body.png%3C/img%3E%3Cbr%20/%3E%3Cbr%20/%3E%3Cspan%20class=" so it obviously didnt know what {memberrow.custom_fields.CUSTOM_FIELD} was and I am not sure what all that junk is after the png, as a test I tried it in my memberlist_body.tpl :- [code linenumbers=false] {memberrow.custom_fields.CUSTOM_FIELD} img src="http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png [/code] the image didnt show however the link was "http://avatar.xboxlive.com/avatar/n1cks21/avatar-body.png%3C/img%3E%20%20%20%20%20%20%20%3Ctd%20class=" which shows it did know what {memberrow.custom_fields.CUSTOM_FIELD} was it just didnt work because of all the junk after png I dont want to upload the avatars to my site as members do change them every now and then and it would mean uploading them all the time. hope that makes sense ----------------------------------- DWho Sat 14 Feb, 2009 11:33 Re: User Block Mod ----------------------------------- remove [b]memberrow.[/b] twice from this code [code linenumbers=false] {memberrow.custom_fields.CUSTOM_FIELD} img src="http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png [/code] memberrow is used in the memberlist code and the variable is not used in the block... let me know :mrgreen: :mrgreen: ----------------------------------- n1cks21 Sat 14 Feb, 2009 12:21 Re: User Block Mod ----------------------------------- [quote user="DWho" post="36636"]remove [b]memberrow.[/b] twice from this code [code linenumbers=false] {memberrow.custom_fields.CUSTOM_FIELD} img src="http://avatar.xboxlive.com/avatar/avatar-body.png [/code] memberrow is used in the memberlist code and the variable is not used in the block... let me know :mrgreen: :mrgreen:[/quote] I tried it in user_block_block, but got the same problem no picture and the URL was:- "http://avatar.xboxlive.com/avatar//avatar-body.png%3C/img%3E%3Cbr%20/%3E%3Cbr%20/%3E%3Cspan%20class=" again it doesnt know what {custom_fields.CUSTOM_FIELD} is and I still dont know what all that junk is after the png "%3C/img%3E%3Cbr%20/%3E%3Cbr%20/%3E%3Cspan%20class=" ----------------------------------- DWho Sat 14 Feb, 2009 13:50 Re: User Block Mod ----------------------------------- Have you added the php code into the block php file..? otherwise it will not know where to call the information from... ----------------------------------- n1cks21 Sat 14 Feb, 2009 14:13 Re: User Block Mod ----------------------------------- [quote user="DWho" post="36642"]Have you added the php code into the block php file..? otherwise it will not know where to call the information from...[/quote] erm.... no :shock: which php code ???? ----------------------------------- DWho Sat 14 Feb, 2009 17:40 Re: User Block Mod ----------------------------------- Well for example in memberlist.php you have this code.. [code linenumbers=false] // Custom Profile Fields MOD - BEGIN include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $profile_data = get_fields('WHERE view_in_memberlist = ' . VIEW_IN_MEMBERLIST . ' AND users_can_view = ' . ALLOW_VIEW); foreach($profile_data as $field) { $template->assign_block_vars('custom_field_names', array('FIELD_NAME' => $field['field_name'])); } $template->assign_var('NUMCOLS', count($profile_data) + 12); // Custom Profile Fields MOD - END[/code] and [code linenumbers=false] // Custom Profile Fields MOD - BEGIN foreach($profile_data as $field) { $name = text_to_column($field['field_name']); $sql2 = "SELECT $name FROM " . USERS_TABLE . " WHERE user_id = $user_id"; if(!($result2 = $db->sql_query($sql2))) message_die(GENERAL_ERROR,'Could not get custom profile data','',__LINE__,__FILE__,$sql2); $val = $db->sql_fetchrow($result2); $val = displayable_field_data($val[$name],$field['field_type']); $template->assign_block_vars('memberrow.custom_fields',array('CUSTOM_FIELD' => $val)); } // Custom Profile Fields MOD - END[/code] this pulls the info from your database and the template code you used above will then show the correct ode in the block... you then need to find the code out of the above that fits the user_block.php file to show correctly... hope the gives you a few hints.. :mrgreen: :mrgreen: ----------------------------------- spydie Sat 14 Feb, 2009 18:31 Re: User Block Mod ----------------------------------- one question . is that the size you want your avatar to apear ??? looks a bit big for me ----------------------------------- n1cks21 Sat 14 Feb, 2009 19:43 Re: User Block Mod ----------------------------------- [quote user="DWho" post="36646"]Well for example in memberlist.php you have this code.. [code linenumbers=false] // Custom Profile Fields MOD - BEGIN include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $profile_data = get_fields('WHERE view_in_memberlist = ' . VIEW_IN_MEMBERLIST . ' AND users_can_view = ' . ALLOW_VIEW); foreach($profile_data as $field) { $template->assign_block_vars('custom_field_names', array('FIELD_NAME' => $field['field_name'])); } $template->assign_var('NUMCOLS', count($profile_data) + 12); // Custom Profile Fields MOD - END[/code] and [code linenumbers=false] // Custom Profile Fields MOD - BEGIN foreach($profile_data as $field) { $name = text_to_column($field['field_name']); $sql2 = "SELECT $name FROM " . USERS_TABLE . " WHERE user_id = $user_id"; if(!($result2 = $db->sql_query($sql2))) message_die(GENERAL_ERROR,'Could not get custom profile data','',__LINE__,__FILE__,$sql2); $val = $db->sql_fetchrow($result2); $val = displayable_field_data($val[$name],$field['field_type']); $template->assign_block_vars('memberrow.custom_fields',array('CUSTOM_FIELD' => $val)); } // Custom Profile Fields MOD - END[/code] this pulls the info from your database and the template code you used above will then show the correct ode in the block... you then need to find the code out of the above that fits the user_block.php file to show correctly... hope the gives you a few hints.. :mrgreen: :mrgreen:[/quote] :shock: :shock: :shock: no hints just a headache hahahahahahahahahaha maybe I should knock this idea on the head it's way to complicated for me :( :( shame nice idea though ----------------------------------- DWho Sat 14 Feb, 2009 20:08 Re: User Block Mod ----------------------------------- Do you want everyone to have the same image...? or the image that gets placed in the users custom field if they have placed an image there...? ----------------------------------- n1cks21 Sat 14 Feb, 2009 22:49 Re: User Block Mod ----------------------------------- [quote user="DWho" post="36659"]Do you want everyone to have the same image...? or the image that gets placed in the users custom field if they have placed an image there...?[/quote] sorry, let me explain..... my site is an xbox 360 site and when members sign up they get asked for there xbox gamertag (custom field), anyone's xbox avatar can been seen at the url of "http://avatar.xboxlive.com/avatar/(gamertag)/avatar-body.png", the best example I can give is if you check [url=http://www.uk-alliance.com]My Site you can see my xbox avatar now, if/when I change my avatar through xbox live that picture automatically updates. all I need to do is pull the info from the database from my Custom Field and insert it into the url, so that when a member signes in they have there own xbox avatar shown in user_block_block which sounds simply but I have no idea how :( :( :( :( :( :( ----------------------------------- Chaotic Sun 15 Feb, 2009 03:46 Re: User Block Mod ----------------------------------- I understand exactly what you are wanting to do. I have an Xbox themed website as well and I used to use the Xbox LIVE Gamercard MOD on my site. I was thinking you could adapt a few changes in the MOD I'm about to post that may give you the results you want. Wherever you see offical Xbox codes, replace them with the avatar codes you have. It's a lengthy MOD and you'll have to find things that aren't easily found using FIND. I was going to perfect this MOD for IP and release it here if the original MOD author would get back to me. Give it a try, but make sure you back up all files that you edit. [spoiler][code linenumbers=false]######################################################################################### ## ## Mod Title: Xbox Live Gamertag ## Mod Version: 1.0.1 (tested and installed on phpbb 2.0.12) ## Author Defender ## ## Description: This will add a gamertag field to profile, memberlist, and topic view. ## This is perfect for game related forums. Gamertag is the name of your ## xbox name when you play. ## ## ## Install time: 15 minutes ## ## ## ## Files to edit:12 ##admin/admin_users.php ## language/lang_english/lang_main.php ## includes/usercp_viewprofile.php ## includes/usercp_register.php ## includes/usercp_avatar.php ## memberlist.php ##viewtopic.php ## templates/YOUR_TEMPLATE/admin/user_edit_body.tpl ## templates/YOUR_TEMPLATE/profile_add_body.tpl ## templates/YOUR_TEMPLATE/profile_view_body.tpl ##templates/YOUR_TEMPLATE/memberlist_body.tpl ## templates/YOUR_TEMPLATE/viewtopic_body.tpl ## ######################################################################################### ## ## Notes: ## Always and I mean ALWAYS make sure to have a backup before attempting to install. ## ## ## Templates: Be sure to install this properly on YOUR_TEMPLATE. Keep in mind that ## any template you use may NOT be exact to the template changes here. ## ## This mod will adds 1 new column to the 'user' database table and that's it. ## You can see this mod in action at http://www.xbox-forums.com/ please visit. ## ######################################################################################### ## ## Versions: ## ## 1.0.1 ## ######################################################################################### # #-----[ SQL ]------------------------------------------- # # First execute the following sql query via phpmyadmin. ALTER TABLE phpbb_users ADD user_gamertag VARCHAR(255) AFTER user_interests; # # ######################################################################################### # #-----[ OPEN ]------------------------------------------ # # language/lang_english/lang_main.php # #-----[ FIND ]--------------------------------------------------- # $lang['Interests'] = 'Interests'; # #-----[ BELOW ADD ]--------------------------------------------------- # $lang['Gamertag'] = 'Gamertag'; # #-----[ OPEN ]------------------------------------------ # # includes/usercp_viewprofile.php # #-----[ FIND ]--------------------------------------------------- # 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ', # #-----[ BELOW ADD ]--------------------------------------------------- # 'GAMERTAG' => ( $profiledata['user_gamertag'] ) ? $profiledata['user_gamertag'] : ' ', 'L_GAMERTAG' => $lang['Gamertag'], # #-----[ OPEN ]------------------------------------------ # # includes/usercp_register.php # #-----[ FIND ]--------------------------------------------------- # $strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests'); # #-----[ IN-LINE FIND ]--------------------------------------------------- # 'interests' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , 'gamertag' => 'gamertag' # #-----[ FIND ]--------------------------------------------------- # $interests = stripslashes($interests); # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = stripslashes($gamertag); # #-----[ FIND AGAIN]--------------------------------------------------- # $interests = stripslashes($interests); # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = stripslashes($gamertag); # #-----[ FIND ]--------------------------------------------------- # $sql = "UPDATE " . USERS_TABLE . " # #-----[ IN-LINE FIND ]--------------------------------------------------- # $interests) . "' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , user_gamertag = '" . str_replace("'", "''", $gamertag) . "' # #-----[ FIND ]--------------------------------------------------- # $sql = "INSERT INTO " . USERS_TABLE . " # #-----[ IN-LINE FIND ]--------------------------------------------------- # user_interests # #-----[ IN-LINE ADD ]--------------------------------------------------- # , user_gamertag # #-----[ IN-LINE FIND ]--------------------------------------------------- # $interests) . "' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , '" . str_replace("'", "''", $gamertag) . "' # #-----[ FIND ]--------------------------------------------------- # $interests = $userdata['user_interests']; # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = $userdata['user_gamertag']; # #-----[ FIND ]--------------------------------------------------- # display_avatar_gallery($mode, $avatar_category # #-----[ IN-LINE FIND ]--------------------------------------------------- # $interests # #-----[ IN-LINE ADD ]--------------------------------------------------- # , $gamertag # #-----[ FIND ]-------------------------- # $template->assign_vars(array( 'USERNAME' => $username, 'CUR_PASSWORD' => $cur_password, 'NEW_PASSWORD' => $new_password, 'PASSWORD_CONFIRM' => $password_confirm, 'EMAIL' => $email, 'CONFIRM_IMG' => $confirm_image, 'YIM' => $yim, 'ICQ' => $icq, 'MSN' => $msn, 'AIM' => $aim, 'OCCUPATION' => $occupation, 'INTERESTS' => $interests, # #-----[ BELOW ADD ]--------------------------------------------------- # 'GAMERTAG' => $gamertag, 'L_GAMERTAG' => $lang['Gamertag'], # #-----[ FIND ]------------------------------------------------------------------ validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature); # #-----[IN-LINE FIND]--------------------------------------------------------------- # $interests # #-----[IN-LINE ADD] ,$gamertag # #-----[ OPEN ]------------------------------------------ # # includes/usercp_avatar.php # #-----[ FIND ]--------------------------------------------------- # function display_avatar_gallery($mode, &$category # #-----[ IN-LINE FIND ]--------------------------------------------------- # &$interests # #-----[ IN-LINE ADD ]--------------------------------------------------- # , &$gamertag # #-----[ FIND ]--------------------------------------------------- # $params = array('coppa', 'user_id' # #-----[ IN-LINE FIND ]--------------------------------------------------- # 'interests' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , 'gamertag' # #-----[ OPEN ]------------------------------------------ # # admin/admin_users.php # #-----[ FIND ]--------------------------------------------------- # $interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : ''; # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = ( !empty($HTTP_POST_VARS['gamertag']) ) ? trim(strip_tags( $HTTP_POST_VARS['gamertag'] ) ) : ''; # #-----[ FIND ]-------------------------------------------- # $interests = htmlspecialchars(stripslashes($interests)); # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = htmlspecialchars(stripslashes($gamertag)); # #-----[ FIND AGAIN ]-------------------------------------------- # $interests = htmlspecialchars(stripslashes($interests)); # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = htmlspecialchars(stripslashes($gamertag)); # #-----[ FIND ]--------------------------------------------------- # $sql = "UPDATE " . USERS_TABLE . " # #-----[ IN-LINE FIND ]--------------------------------------------------- # $interests) . "' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , user_gamertag = '" . str_replace("'", "''", $gamertag) . "' # #-----[ FIND ]--------------------------------------------------- # $interests = htmlspecialchars($this_userdata['user_interests']); # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = htmlspecialchars($this_userdata['user_gamertag']); # #-----[ FIND ]--------------------------------------------------- # $s_hidden_fields .= ''; # #-----[ BELOW ADD ]--------------------------------------------------- # $s_hidden_fields .= ''; # #-----[ FIND ]--------------------------------------------------- # 'INTERESTS' => $interests, # #-----[ BELOW ADD ]--------------------------------------------------- # 'GAMERTAG' => $gamertag, 'L_GAMERTAG' => $lang['Gamertag'], # #-----[ OPEN ]------------------------------------------ # # templates/YOUR_TEMPLATE/profile_add_body.tpl # #-----[ FIND ]--------------------------------------------------- # {L_INTERESTS}: # #-----[ BELOW ADD ]--------------------------------------------------- # {L_GAMERTAG}: # #-----[ OPEN ]------------------------------------------ # # templates/YOUR_TEMPLATE/profile_view_body.tpl # #-----[ FIND ]--------------------------------------------------- # {L_INTERESTS}: {INTERESTS} # #-----[ BELOW ADD ]--------------------------------------------------- # {L_GAMERTAG}: {GAMERTAG} # #-----[ OPEN ]------------------------------------------ # # templates/YOUR_TEMPLATE/admin/user_edit_body.tpl # #-----[ FIND ]--------------------------------------------------- # {L_INTERESTS} # #-----[ BELOW ADD ]--------------------------------------------------- # {L_GAMERTAG} #-----[ OPEN ]------------------------------------------ # # memberlist.php # #-----[ FIND ]--------------------------------------------------- # $mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'], $lang['Sort_Website'], $lang['Sort_Top_Ten']); $mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten'); # #-----[ IN-LINE FIND ]--------------------------------------------------- # $lang['Sort_Location'] # #-----[ IN-LINE ADD ]--------------------------------------------------- # , $lang['Gamertag'] # #-----[ IN-LINE FIND ]--------------------------------------------------- # 'location' # #-----[ IN-LINE ADD ]--------------------------------------------------- # , 'gamertag' # #-----[ FIND ]--------------------------------------------------- # 'L_FROM' => $lang['Location'], # #-----[ BELOW ADD ]--------------------------------------------------- # 'L_GAMERTAG' => $lang['Gamertag'], # #-----[ FIND ]--------------------------------------------------- # case 'location': $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; # #-----[ BELOW ADD ]--------------------------------------------------- # case 'gamertag': $order_by = "user_gamertag $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; # #-----[ FIND ]--------------------------------------------------- # $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar # #-----[ IN-LINE FIND ]--------------------------------------------------- # user_from # #-----[ IN-LINE ADD ]--------------------------------------------------- # , user_gamertag # #-----[ FIND ]--------------------------------------------------- # $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; # #-----[ BELOW ADD ]--------------------------------------------------- # $gamertag = ( !empty($row['user_gamertag']) ) ? $row['user_gamertag'] : ' '; # #-----[ FIND ]--------------------------------------------------- # 'FROM' => $from, # #-----[ BELOW ADD ]--------------------------------------------------- # 'GAMERTAG' => $gamertag, # #-----[ OPEN ]------------------------------------------ # # templates/YOUR_TEMPLATE/memberlist_body.tpl # #-----[ FIND ]--------------------------------------------------- # {L_FROM} # #-----[ BELOW ADD ]--------------------------------------------------- # {L_GAMERTAG} # #-----[ FIND ]--------------------------------------------------- # {memberrow.FROM} # #-----[ BELOW ADD ]--------------------------------------------------- # {memberrow.GAMERTAG} # #-----[ FIND ]--------------------------------------------------- # # OPTIONAL- Please check your template before performing the next change as it may not be needed. # Please increase your colspan value by 1 on the next line. If you´ve installed other mods the value # may be bigger than the default 8. Find the next line and increase the colspan by 1. #   # #-----[ OPEN ]------------------------------------------ # # viewtopic.php # #-----[ FIND ]--------------------------------------------------- # $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid # #-----[ IN-LINE FIND ]--------------------------------------------------- # u.user_from # #-----[ IN-LINE ADD ]--------------------------------------------------- # , u.user_gamertag # #-----[ FIND ]--------------------------------------------------- # $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; # #-----[ BELOW ADD ]--------------------------------------------------- # $poster_gamertag = ( $postrow[$i]['user_gamertag'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Gamertag'] . ': ' . $postrow[$i]['user_gamertag'] : ''; # #-----[ FIND ]--------------------------------------------------- # 'POSTER_FROM' => $poster_from, # #-----[ BELOW ADD ]--------------------------------------------------- # 'POSTER_GAMERTAG' => $poster_gamertag, # #-----[ OPEN ]------------------------------------------ # # templates/YOUR_TEMPLATE/viewtopic_body.tpl # #-----[ FIND ]--------------------------------------------------- # {postrow.POSTER_FROM} # #-----[ AFTER ADD ]--------------------------------------------------- #
{postrow.POSTER_GAMERTAG} ######################################################################################### # # # That's all folk[/code][/spoiler] ----------------------------------- n1cks21 Sun 15 Feb, 2009 04:17 Re: User Block Mod ----------------------------------- thanks Chaotic I will give it a try, I am not very confident around IP but am willing to try...... at least you understand what I am trying to do, I am not very good at explaining things...... Nick ----------------------------------- Chaotic Sun 15 Feb, 2009 04:25 Re: User Block Mod ----------------------------------- You also need to make these changes after installing the MOD. [u]Be aware that you'll be using iFrame. It's recommended you don't use this code, so please use at your own risk. We won't be held responsible for any harm that may come of adding these codes![/u] [color=#ff0026]To display the gamercard in profile:[/color] [b]OPEN:[/b] [i]/includes/usercp_viewprofile.php[/i] [b]FIND:[/b] [code linenumbers=false][code linenumbers=false]'GAMERTAG' => ( $profiledata['user_gamertag'] ) ? $profiledata['user_gamertag'] : ' ',[/code][/code] [b]REPLACE WITH:[/b] [code linenumbers=false] 'GAMERTAG' => ( $profiledata['user_gamertag'] ) ? '' :'',[/code] [color=#ff0019]To display gamercard in viewtopic:[/color] [b]OPEN:[/b] [i]/viewtopic.php[/i] [b]FIND:[/b] [code linenumbers=false]$poster_gamertag = ( $postrow[$i]['user_gamertag'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Gamertag'] . ': ' . $postrow[$i]['user_gamertag'] : '';[/code] [b]REPLACE WITH:[/b] [code linenumbers=false] $poster_gamertag = ( $postrow[$i]['user_gamertag'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? '' : '';[/code] ----------------------------------- DWho Sun 15 Feb, 2009 11:17 Re: User Block Mod ----------------------------------- Thanks Chaotic...saved me from going through files... :mrgreen: :mrgreen: ----------------------------------- Chaotic Sun 15 Feb, 2009 13:35 Re: User Block Mod ----------------------------------- No problem! This will surely work for someone wanting to add their Xbox LIVE Avatar. All you gotta do is replace the iFrame code I bet. ----------------------------------- n1cks21 Sun 15 Feb, 2009 17:40 Re: User Block Mod ----------------------------------- I am a bit confused, :oops: :oops: does the above code give me a Gamertag field ??? becuase I have one already that I created in Custom fields, and is shown correctly in memberlist see below :- [img]http://www.uk-alliance.com/images/avatar0.jpg[/img] what I want to do is have my user_block_block look like this when your not signed in (which is how it looks now) [img]http://www.uk-alliance.com/images/avatar1.jpg[/img] and look like this when you are signed in (but with your own xbox avatar) the below was done using photoshop to give u an idea of what I am after [img]http://www.uk-alliance.com/images/avatar2.jpg[/img] I only want the xbox avatar shown in the user_block_block ----------------------------------- Chaotic Sun 15 Feb, 2009 17:54 Re: User Block Mod ----------------------------------- That is totally my fault. I saw your topic title and it does say User Block. I was thinking you wanted to show your Xbox LIVE Avatar on viewtopic, but you wanted it to replace the avatar in the User Block. :( ----------------------------------- n1cks21 Sun 15 Feb, 2009 21:12 Re: User Block Mod ----------------------------------- partial success, I have managed to make it work in the memberlist_body, but that is only becuase {memberrow.custom_fields.CUSTOM_FIELD} has been defined there, what I need to do is query the database in user_block_block but I am not sure how :oops: :oops: :oops: :oops: ----------------------------------- Lopalong Sun 15 Feb, 2009 23:31 Re: User Block Mod ----------------------------------- Im not sure what this Gamer thing is But! Try this: Copy avatar-body.png To /images/avatar-body.png [spoiler][code linenumbers=false]Open: /blocks_imp_user_block.php FIND: $template->assign_vars(array( 'AVATAR_IMG' => $avatar_img, 'U_NAME_LINK' => $name_link, 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(PROFILE_MG . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '', ''), 'L_NEW_SEARCH' => $lang['Search_new'] ) ); AFTER ADD: if( $userdata['session_logged_in'] ) $template->assign_vars(array( 'AVATAR_IMG' => '', 'U_NAME_LINK' => $name_link, 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(PROFILE_MG . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '', ''), 'L_NEW_SEARCH' => $lang['Search_new']) ); Test it and then: Change this to whatever your Gamer Parameters are ? and don't have any ' in the string - use only double quotes. [/code][/spoiler] ----------------------------------- DWho Mon 16 Feb, 2009 00:27 Re: User Block Mod ----------------------------------- if Lobalongs code does not work (though I am sure it will) I will have a look as I have place custom fields code in another file recently... to pi**ed at the moment to concentrate on it.. :mrgreen: :mrgreen: ----------------------------------- n1cks21 Mon 16 Feb, 2009 01:25 Re: User Block Mod ----------------------------------- Lopalong, your code worked however the link I need to use for the avatar is :- "http://avatar.xboxlive.com/avatar/[color=#ff0000] custom field value for the user [/color] /avatar-body.png" The contents of my custom field is each members gamertag (xbox name) which they are required to enter when they register mine is n1cks21 so my xbox avatar link is "http://avatar.xboxlive.com/avatar/[color=#ff0000]n1cks21[/color] /avatar-body.png" I have used this link "http://avatar.xboxlive.com/avatar/[color=#ff0000] {memberrow.custom_fields.CUSTOM_FIELD}[/color] /avatar-body.png" in the members screen with the following results :- a different avatar pic for each member :mryellow: :mryellow: [img]http://www.uk-alliance.com/images/avatar3.jpg[/img] I need to use your code with my link, sql needs to be queried for the vale of the custom field for the member logging in and that value to be entered into the link "http://avatar.xboxlive.com/avatar/[color=#ff0000]custom field value [/color] /avatar-body.png" sorry I dont know how else to explain it :( :( :( ----------------------------------- Lopalong Mon 16 Feb, 2009 01:46 Re: User Block Mod ----------------------------------- Not sure where we're at with this, but try the script below as it includes the string you use elsewhere with the spaces removed. [code linenumbers=false]AFTER ADD: if( $userdata['session_logged_in'] ) $template->assign_vars(array( 'AVATAR_IMG' => '', 'U_NAME_LINK' => $name_link, 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(PROFILE_MG . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '', ''), 'L_NEW_SEARCH' => $lang['Search_new']) ); If you get any errors about "Unexpected whatever" then try this string. Either way let us know what happens. [/code] [b]Arrivederci![/b] [i]Now I'm out of here for a couple of months or maybe longer.[/i] ;) ----------------------------------- n1cks21 Mon 16 Feb, 2009 11:37 Re: User Block Mod ----------------------------------- [quote user="Lopalong" post="36711"][b]Arrivederci![/b] [i]Now I'm out of here for a couple of months or maybe longer.[/i] ;)[/quote] :mryellow: :mryellow: Well thanks for all your help The above link didnt work :( but I am pretty sure it's because "{memberrow.custom_fields.CUSTOM_FIELD}" has no value, I am sure there should be some sort of sql query before the above code giving "{memberrow.custom_fields.CUSTOM_FIELD}" it's value. ----------------------------------- DWho Mon 16 Feb, 2009 19:25 Re: User Block Mod ----------------------------------- Ok I got this to work for you here is the code let me know... replace all the code in blocks/blocks_imp_user_block.php with [spoiler][code linenumbers=false]= " . $userdata['user_lastvisit'] . " AND poster_id <> " . $userdata['user_id'] . " AND post_time < " . time(); $result = $db->sql_query($sql); if( $result ) { $row = $db->sql_fetchrow($result); $lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")"; } }*/ $avatar_img = user_get_avatar($userdata['user_id'], $userdata['user_avatar'], $userdata['user_avatar_type'], $userdata['user_allowavatar']); // Check For Anonymous User if ($userdata['user_id'] != ANONYMOUS) { $username = colorize_username($userdata['user_id']); } else { $username = $lang['Guest']; $avatar_img = ''; } if ($userdata['user_id'] != '-1') { $userdata['username'] = colorize_username($userdata['user_id']); $name_link = $userdata['username']; } else { $name_link = $lang['Guest']; } // Custom Profile Fields - BEGIN // Include Language $language = $board_config['default_lang']; if ( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_profile_fields.' . $phpEx) ) { $language = 'english'; } include($phpbb_root_path . 'language/lang_' . $language . '/lang_profile_fields.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $profile_data = get_fields('WHERE view_in_profile = ' . VIEW_IN_PROFILE . ' AND users_can_view = ' . ALLOW_VIEW); $profile_names = array(); $abouts = array(); $contacts = array(); foreach($profile_data as $field) { $name = $field['field_name']; $col_name = text_to_column($field['field_name']); $id = $userdata['user_id']; $type = $field['field_type']; $location = $field['profile_location']; $field_id = $field['field_id']; $field_name = $field['field_name']; if (isset($lang[$field_id . '_' . $field_name])) { $field_name = $lang[$field_id . '_' . $field_name]; } $sql = "SELECT $col_name FROM " . USERS_TABLE . " WHERE user_id = $id"; if(!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR,'Could not obtain field value','',__LINE__,__FILE__,$sql); } $temp = $db->sql_fetchrow($result); $profile_names[$name] = displayable_field_data($temp[$col_name],$field['field_type']); $tmp_field = $profile_names[$name]; if (isset($lang[$field_id . '_' . $tmp_field])) { $profile_names[$name] = $lang[$field_id . '_' . $tmp_field]; } if($location == 1) { $contacts[] = '' . $field_name . '' . $profile_names[$name] . ' '; } else { $abouts[] = ''; } } foreach($abouts as $about_field) { $template->assign_block_vars('custom_about',array('ABOUT' => $about_field)); } foreach($contacts as $contact_field) { $template->assign_block_vars('custom_contact',array('CONTACT' => $contact_field)); } // Custom Profile Fields - END $template->assign_vars(array( 'AVATAR_IMG' => $avatar_img, 'U_NAME_LINK' => $name_link, 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(PROFILE_MG . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '', ''), 'L_NEW_SEARCH' => $lang['Search_new'] ) ); } } imp_user_block_block_func(); ?>[/code][/spoiler] open templates/YOUR TEMPLATE/blocks/user_block_block.tpl and replace all the code with [spoiler][code linenumbers=false] {custom_about.ABOUT}
{U_NAME_LINK}

{AVATAR_IMG}
{L_USERNAME}:

{L_PASSWORD}:


 {L_REMEMBER_ME}



{L_SEND_PASSWORD}
[/code][/spoiler] Goto admin and set the field to whatever you are calling it... [b]Field Type[/b] text [b]Viewable in User Profile[/b] yes [b]These options are for if this field is to be viewed in the user's profile.[/b] about column and save you just have to add your name to the text box you have created so for you it would be [b]n1cks21[/b] but I am not sure if you can create any more custom fields now though [b]logged out[/b] [img]http://www.icyphoenix.com/files/images/166/logged_out.png[/img] [b]logged in[/b] [img]http://www.icyphoenix.com/files/images/166/logged_in.png[/img] Let me know :mrgreen: :mrgreen: :mrgreen: ----------------------------------- n1cks21 Mon 16 Feb, 2009 21:33 Re: User Block Mod ----------------------------------- Thanks for looking at this for me, It still doesnt work however it doesnt give me any errors either, basically when you log in it puts you on the profile page and not the home page, if you click on home page, you simply get the users login name ??? I had already created a custom field and it was already set as Field Type text Viewable in User Profile yes [img]http://www.uk-alliance.com/images/avatar4.jpg[/img] ----------------------------------- DWho Mon 16 Feb, 2009 21:36 Re: User Block Mod ----------------------------------- I have this working on my site.... did you copy all the code over... and set it to the about column and you copied the code for the php block code as well as the tpl code.... 2 files ----------------------------------- n1cks21 Mon 16 Feb, 2009 23:58 Re: User Block Mod ----------------------------------- school boy error :oops: :oops: :oops: yes it works fine now I have changed it to the about column, which you stated in your last post :oops: :oops: Thank you soooooo much, you are the man, what a cracking xbox360 mod, one question though what are the chances of getting the text info underneath the avatar as shown on the pic below :?: :?: :?: or am I pushing my luck and I should be happy with what I have got hehehehehehehehehehe [img]http://www.uk-alliance.com/images/avatar2.jpg[/img] Eitherway I would like to thank everyone who has helped......... ----------------------------------- DWho Tue 17 Feb, 2009 00:32 Re: User Block Mod ----------------------------------- Glad you got it sorted... I will post the modification in a new post so others can download the zip where did you get the other info from then I can add it.. :mrgreen: :mrgreen: ----------------------------------- n1cks21 Tue 17 Feb, 2009 00:52 Re: User Block Mod ----------------------------------- I seem to have this problem now, sorry only just noticed it :- [img]http://www.uk-alliance.com/images/avatar5.jpg[/img] the picture that is trying to be displayed os the avatar pic "http://avatar.xboxlive.com/avatar//avatar-body.png" not sure why it's trying to do that ???? my code for blocks_imp_user_block [spoiler]= " . $userdata['user_lastvisit'] . " AND poster_id <> " . $userdata['user_id'] . " AND post_time < " . time(); $result = $db->sql_query($sql); if( $result ) { $row = $db->sql_fetchrow($result); $lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")"; } }*/ $avatar_img = user_get_avatar($userdata['user_id'], $userdata['user_avatar'], $userdata['user_avatar_type'], $userdata['user_allowavatar']); // Check For Anonymous User if ($userdata['user_id'] != ANONYMOUS) { $username = colorize_username($userdata['user_id']); } else { $username = $lang['Guest']; $avatar_img = ''; } if ($userdata['user_id'] != '-1') { $userdata['username'] = colorize_username($userdata['user_id']); $name_link = $userdata['username']; } else { $name_link = $lang['Guest']; } // Custom Profile Fields - BEGIN // Include Language $language = $board_config['default_lang']; if ( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_profile_fields.' . $phpEx) ) { $language = 'english'; } include($phpbb_root_path . 'language/lang_' . $language . '/lang_profile_fields.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $profile_data = get_fields('WHERE view_in_profile = ' . VIEW_IN_PROFILE . ' AND users_can_view = ' . ALLOW_VIEW); $profile_names = array(); $abouts = array(); $contacts = array(); foreach($profile_data as $field) { $name = $field['field_name']; $col_name = text_to_column($field['field_name']); $id = $userdata['user_id']; $type = $field['field_type']; $location = $field['profile_location']; $field_id = $field['field_id']; $field_name = $field['field_name']; if (isset($lang[$field_id . '_' . $field_name])) { $field_name = $lang[$field_id . '_' . $field_name]; } $sql = "SELECT $col_name FROM " . USERS_TABLE . " WHERE user_id = $id"; if(!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR,'Could not obtain field value','',__LINE__,__FILE__,$sql); } $temp = $db->sql_fetchrow($result); $profile_names[$name] = displayable_field_data($temp[$col_name],$field['field_type']); $tmp_field = $profile_names[$name]; if (isset($lang[$field_id . '_' . $tmp_field])) { $profile_names[$name] = $lang[$field_id . '_' . $tmp_field]; } if($location == 1) { $contacts[] = '' . $field_name . '' . $profile_names[$name] . ' '; } else { $abouts[] = ''; } } foreach($abouts as $about_field) { $template->assign_block_vars('custom_about',array('ABOUT' => $about_field)); } foreach($contacts as $contact_field) { $template->assign_block_vars('custom_contact',array('CONTACT' => $contact_field)); } // Custom Profile Fields - END $template->assign_vars(array( 'AVATAR_IMG' => $avatar_img, 'U_NAME_LINK' => $name_link, 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(PROFILE_MG . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '', ''), 'L_NEW_SEARCH' => $lang['Search_new'] ) ); } } imp_user_block_block_func(); ?>[/spoiler] and my user_block_block [spoiler] {custom_about.ABOUT}
{U_NAME_LINK}

{AVATAR_IMG}
{L_USERNAME}:

{L_PASSWORD}:


 {L_REMEMBER_ME}



{L_SEND_PASSWORD}
[/spoiler] :?: :?: :?: :?: ----------------------------------- DWho Fri 20 Feb, 2009 23:42 Re: User Block Mod ----------------------------------- did you sort this.... ? :mrgreen: :mrgreen: ----------------------------------- n1cks21 Sat 21 Feb, 2009 01:27 Re: User Block Mod ----------------------------------- :( :( :( no any help would be great ----------------------------------- DWho Sat 21 Feb, 2009 12:06 Re: User Block Mod ----------------------------------- ok try this open [b]user_block_block.tpl[/b] [color=darkred][size=14]replace all the code with this[/size][/color] [spoiler][code linenumbers=false] {custom_about.ABOUT}
{U_NAME_LINK}

{AVATAR_IMG}
{L_USERNAME}:

{L_PASSWORD}:


 {L_REMEMBER_ME}



{L_SEND_PASSWORD}
[/code][/spoiler] nothing else to change... have tested in firefox and IE let me know :mrgreen: :mrgreen: ----------------------------------- n1cks21 Sat 21 Feb, 2009 13:50 Re: User Block Mod ----------------------------------- fan-bloody-tastic :mryellow: :mryellow: :mryellow: Works a treat now, a mega xbox360 mod thanks for making my idea become reality the only thing I would like to add would be the old code below, to underneath the avatar [spoiler] {U_NAME_LINK}
{LAST_VISIT_DATE}
{L_NEW_SEARCH}

[/spoiler] once again Thank You for all your time and effort you put into this, its much appreciated. :v: :v: :v: :v: :v: :v: :v: :v: :v: :v: :v: ----------------------------------- DWho Sat 21 Feb, 2009 15:09 Re: User Block Mod ----------------------------------- brilliant... to add the last bit of code... open [b]user_block_block.tpl [/b] find [code linenumbers=false] {U_NAME_LINK} {custom_about.ABOUT} [/code] and replace with [code linenumbers=false] {custom_about.ABOUT} {U_NAME_LINK}
{LAST_VISIT_DATE}
{L_NEW_SEARCH}

[/code] let me know :mrgreen: :mrgreen: ----------------------------------- n1cks21 Sat 21 Feb, 2009 16:21 SOLVED - Re: User Block Mod ----------------------------------- :D :D :D :D :D :D :D :D :D :D :D :D SPOT ON !!!!!!!!!!!!!!!!!!! it looks fantastic :v: :v: :v: :v: :v: :v: :v: again thanks for all your time, effort and trouble :mryellow: :mryellow: :mryellow: :mryellow: ----------------------------------- DWho Sat 21 Feb, 2009 16:29 Re: User Block Mod ----------------------------------- no problem happy to help... glad it is all fixed now... :mrgreen: :mrgreen: ----------------------------------- n1cks21 Sun 22 Feb, 2009 01:36 Re: SOLVED - User Block Mod ----------------------------------- dont want to be a pain in the arse but the only other change is simply cosmetic Forum Page [img]http://www.uk-alliance.com/images/avatar7.jpg[/img] the avatar pic has a border of some sort so there is a line across the block Home Page [img]http://www.uk-alliance.com/images/avatar6.jpg[/img] same as the first one with a border but the bottom is a different colour from the top *****************UPDATE****************** I fixed it by doing the following, not sure if it's the best way or indeed the easiest but I do like to try and fix my problems first:- blocks_imp_user_block [spoiler] From $abouts[] = ''; To $abouts[] = '';[/spoiler] and user_block_block [spoiler] From To
[/spoiler] bgcolor="#081838" and changed this to the colour I wanted. result is:- [img]http://www.uk-alliance.com/images/avatar8.jpg[/img] ----------------------------------- DWho Sun 22 Feb, 2009 13:41 Re: SOLVED - User Block Mod ----------------------------------- Nice one and thanks for posting the fix.... :mrgreen: :mrgreen: ----------------------------------- n1cks21 Mon 23 Feb, 2009 15:48 Re: SOLVED - User Block Mod ----------------------------------- no worries, there was propbably a better way, but it works for me :wink: thanks again............. ----------------------------------- n1cks21 Sun 13 Sep, 2009 11:23 Re: SOLVED - User Block Mod ----------------------------------- Hi all the above mod is fantastic and works a treat on my site however it's time to move to 1.3.0.53 and I wondered how hard it would be to update the above mod to work on the new version ???? cheers Nick ----------------------------------- Lopalong Sun 13 Sep, 2009 14:00 Re: SOLVED - User Block Mod ----------------------------------- I shouldn't think it would be any problem - But did you check that DWho hasn't already done it and has it available on his site - Before you asked the question? I also find it annoying that users suggest such things as "I will upgrade to 53 etc, so long as this MOD is available" :x You upgrade - Then I'll sure Mike will (if necessary) upgrade the MOD - [b]WHEN [i][u]HE[/u][/i] FINDS THE TIME! [/b] :shock: ----------------------------------- n1cks21 Sun 13 Sep, 2009 14:31 Re: SOLVED - User Block Mod ----------------------------------- [quote user="Lopalong" post="44368"]I shouldn't think it would be any problem - But did you check that DWho hasn't already done it and has it available on his site - Before you asked the question? I also find it annoying that users suggest such things as "I will upgrade to 53 etc, so long as this MOD is available" :x You upgrade - Then I'll sure Mike will (if necessary) upgrade the MOD - [b]WHEN [i][u]HE[/u][/i] FINDS THE TIME! [/b] :shock:[/quote] yeah I did have a look on DWho site, I didnt see it so I posted the question on here..... I would also like to avoid downtime as well, so it only makes sense to upgrade and install the mods at the same time, I have installed the new software on the test area of my server, I now want to add the mods so I know everything works before I go live. I have already installed 2 of your fantastic mods (Security Question and Urls) and all I think is left is the above mod as well as the 80% mod. I always give praise to you guys as I think you all do a fantastic job, my site has had lots of positive feedback and I owe that to you guys..... so I am sorry if I offended or annoyed you.... ----------------------------------- Lopalong Sun 13 Sep, 2009 14:41 Re: SOLVED - User Block Mod ----------------------------------- Then it would be appropriate for you to register at Mike's site and ask him if he would consider checking the MOD and upgrading it (if necessary) when he gets the time. Because pushing the issue ain't going to win you any friends. ;) MODS take a lot of work my friend - So does upgrading existing ones to IP v1.3* - And, you haven't even tested what you've got yet, (Even on localhost - which you should have) so you don't even know if it doesn't work. ----------------------------------- n1cks21 Sun 13 Sep, 2009 14:54 Re: SOLVED - User Block Mod ----------------------------------- :oops: :oops: :oops: my bad, I wrongly assumed that all previous mods wouldnt work on the new version. I will put my current mods on the new version and see what happens. thanks for the info and sorry for wssting your time............