SOLVED - User Block Mod


Goto page 1, 2, 3, 4  Next

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 ??? :( :(

Last edited by n1cks21 on Sat 21 Feb, 2009 18:02; edited 1 time in total
Subject: Re: User Block Mod
are we talking about this user block?

user_block_alt

what you want to do exactly ?

Subject: Re: User Block Mod
Limun wrote: [View Post]
are we talking about this user block?

user_block_alt

what you want to do exactly ?


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

avatar-body

which is "http://avatar.xboxlive.com/avatar/n1cks21/avatar-body.png"

hope thats make sense

Subject: 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

Subject: Re: User Block Mod
you can try like this

Spoiler: [ Show ]


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: [Download] [Hide] [Select]
http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png

well try then we gona see :?

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 :-

Code: [Download] [Hide] [Select]
<!-- BEGIN custom_fields -->
<td class="row1 row-center">{memberrow.custom_fields.CUSTOM_FIELD}</td>
img src="http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png</img>
<!-- END custom_fields -->


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

Subject: Re: User Block Mod
remove memberrow. twice from this code

Code: [Download] [Hide] [Select]
<!-- BEGIN custom_fields -->
<td class="row1 row-center">{memberrow.custom_fields.CUSTOM_FIELD}</td>
img src="http://avatar.xboxlive.com/avatar/{memberrow.custom_fields.CUSTOM_FIELD}/avatar-body.png</img>
<!-- END custom_fields -->


memberrow is used in the memberlist code and the variable is not used in the block...

let me know

:mrgreen: :mrgreen:

Subject: Re: User Block Mod
DWho wrote: [View Post]
remove memberrow. twice from this code

Code: [Download] [Hide] [Select]
<!-- BEGIN custom_fields -->
<td class="row1 row-center">{memberrow.custom_fields.CUSTOM_FIELD}</td>
img src="http://avatar.xboxlive.com/avatar/avatar-body.png</img>
<!-- END custom_fields -->


memberrow is used in the memberlist code and the variable is not used in the block...

let me know

:mrgreen: :mrgreen:


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="

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...

Subject: Re: User Block Mod
DWho wrote: [View Post]
Have you added the php code into the block php file..?

otherwise it will not know where to call the information from...


erm.... no :shock: which php code ????

Subject: Re: User Block Mod
Well for example in memberlist.php you have this code..

Code: [Download] [Hide] [Select]
// 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


and

Code: [Download] [Hide] [Select]
// 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


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:

Subject: Re: User Block Mod
one question .

is that the size you want your avatar to apear ???

looks a bit big for me

Subject: Re: User Block Mod
DWho wrote: [View Post]
Well for example in memberlist.php you have this code..

Code: [Download] [Hide] [Select]
// 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


and

Code: [Download] [Hide] [Select]
// 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


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:



: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

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...?

Subject: Re: User Block Mod
DWho wrote: [View Post]
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 :( :( :( :( :( :(

Goto page 1, 2, 3, 4  Next

Page 1 of 4


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.2826s (PHP: 3% SQL: 97%)
SQL queries: 16 - Debug On - GZIP Enabled