n1cks21 [ Tue 10 Feb, 2009 18:52 ] Post subject: 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 ] Post subject: Re: User Block Mod
are we talking about this user block?
what you want to do exactly ?
n1cks21 [ Sat 14 Feb, 2009 00:43 ] Post subject: Re: User Block Mod
n1cks21 [ Sat 14 Feb, 2009 04:05 ] Post subject: 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 :-
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 ] Post subject: 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 ] Post subject: 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...?
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 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 ] Post subject: 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.
#########################################################################################
##
## 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;
#
#-----[ 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.
#
#
#-----[ AFTER ADD ]---------------------------------------------------
#
<br />{postrow.POSTER_GAMERTAG}
#########################################################################################
#
#
# That's all folk
n1cks21 [ Sun 15 Feb, 2009 04:17 ] Post subject: 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 ] Post subject: Re: User Block Mod
You also need to make these changes after installing the MOD. 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!
DWho [ Sun 15 Feb, 2009 11:17 ] Post subject: Re: User Block Mod
Thanks Chaotic...saved me from going through files...
Chaotic [ Sun 15 Feb, 2009 13:35 ] Post subject: 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 ] Post subject: Re: User Block Mod
I am a bit confused,
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 :-
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)
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
I only want the xbox avatar shown in the user_block_block
Chaotic [ Sun 15 Feb, 2009 17:54 ] Post subject: 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 ] Post subject: 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
Lopalong [ Sun 15 Feb, 2009 23:31 ] Post subject: Re: User Block Mod
Change this to whatever your Gamer Parameters are ? and don't have any ' in the string - use only double quotes.
<img src="images/avatar-body.png" alt=""/>
DWho [ Mon 16 Feb, 2009 00:27 ] Post subject: 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..
n1cks21 [ Mon 16 Feb, 2009 01:25 ] Post subject: Re: User Block Mod
Lopalong, your code worked however the link I need to use for the avatar is :-
"http://avatar.xboxlive.com/avatar/ custom field value for the user /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/n1cks21 /avatar-body.png"
I have used this link "http://avatar.xboxlive.com/avatar/ {memberrow.custom_fields.CUSTOM_FIELD} /avatar-body.png" in the members screen with the following results :-
a different avatar pic for each member
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/custom field value /avatar-body.png"
sorry I dont know how else to explain it
Lopalong [ Mon 16 Feb, 2009 01:46 ] Post subject: 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.
Arrivederci!Now I'm out of here for a couple of months or maybe longer.
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 ] Post subject: 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
<?php
/***************************************************************************
* blocks_imp_user_block.php
* -------------------
* begin : Saturday, March 20, 2004
* copyright : (C) 2004 masterdavid - Ronald John David
* website : http://www.integramod.com
* email : webmaster@integramod.com
*
* note: removing the original copyright is illegal even you have modified
* the code. Just append yours if you have modified it.
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
if(!function_exists(imp_user_block_block_func))
{
function imp_user_block_block_func()
{
global $userdata, $template, $board_config, $name, $lang, $db, $phpEx;
include_once($phpbb_root_path . 'includes/functions_groups.' . $phpEx);
/*if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $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'] . ")";
}
}*/
</td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
Goto admin and set the field to whatever you are calling it...
Field Type text
Viewable in User Profile yes
These options are for if this field is to be viewed in the user's profile. about column
and save
you just have to add your name to the text box you have created so for you it would be n1cks21
but I am not sure if you can create any more custom fields now though
logged out
logged in
Let me know
n1cks21 [ Mon 16 Feb, 2009 21:33 ] Post subject: 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
DWho [ Mon 16 Feb, 2009 21:36 ] Post subject: 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 ] Post subject: Re: User Block Mod
school boy error
yes it works fine now I have changed it to the about column, which you stated in your last post
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
Eitherway I would like to thank everyone who has helped.........
DWho [ Tue 17 Feb, 2009 00:32 ] Post subject: 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..
n1cks21 [ Tue 17 Feb, 2009 00:52 ] Post subject: Re: User Block Mod
I seem to have this problem now, sorry only just noticed it :-
the picture that is trying to be displayed os the avatar pic
<?php
/***************************************************************************
* blocks_imp_user_block.php
* -------------------
* begin : Saturday, March 20, 2004
* copyright : (C) 2004 masterdavid - Ronald John David
* website : http://www.integramod.com
* email :
*
* note: removing the original copyright is illegal even you have modified
* the code. Just append yours if you have modified it.
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
if(!function_exists(imp_user_block_block_func))
{
function imp_user_block_block_func()
{
global $userdata, $template, $board_config, $name, $lang, $db, $phpEx;
include_once($phpbb_root_path . 'includes/functions_groups.' . $phpEx);
/*if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $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'] . ")";
}
}*/
bgcolor="#081838" and changed this to the colour I wanted.
result is:-
DWho [ Sun 22 Feb, 2009 13:41 ] Post subject: Re: SOLVED - User Block Mod
Nice one and thanks for posting the fix....
n1cks21 [ Mon 23 Feb, 2009 15:48 ] Post subject: Re: SOLVED - User Block Mod
no worries, there was propbably a better way, but it works for me
thanks again.............
n1cks21 [ Sun 13 Sep, 2009 11:23 ] Post subject: 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 ] Post subject: 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"
You upgrade - Then I'll sure Mike will (if necessary) upgrade the MOD - WHEN HE FINDS THE TIME!
n1cks21 [ Sun 13 Sep, 2009 14:31 ] Post subject: 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"
You upgrade - Then I'll sure Mike will (if necessary) upgrade the MOD - WHEN HE FINDS THE TIME!
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 ] Post subject: 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 ] Post subject: Re: SOLVED - User Block Mod
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............