Icy Phoenix

     
 

SOLVED - User Block Mod

SOLVED - User Block Mod

Article
Reply with quote    Download Post  
Post 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 
n1cks21 - View user's profile Send private message  
n1cks21 [ Tue 10 Feb, 2009 18:52 ]
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us


SOLVED - User Block Mod

Comments
Reply with quote    Download Post  
Post Re: User Block Mod 
 
are we talking about this user block?

user_block_alt

what you want to do exactly ?



 
Limun - View user's profile Send private message  
Limun [ Fri 13 Feb, 2009 16:30 ]
Reply with quote    Download Post  
Post 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



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 00:43 ]
Reply with quote    Download Post  
Post 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



 
spydie - View user's profile Send private message  
spydie [ Sat 14 Feb, 2009 00:48 ]
Reply with quote    Download Post  
Post 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  



 
Limun - View user's profile Send private message  
Limun [ Sat 14 Feb, 2009 01:12 ]
Reply with quote    Download Post  
Post 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



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 04:05 ]
Reply with quote    Download Post  
Post 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

   



 
DWho - View user's profile Send private message  
DWho [ Sat 14 Feb, 2009 11:33 ]
Reply with quote    Download Post  
Post 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

   


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



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 12:21 ]
Reply with quote    Download Post  
Post 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...



 
DWho - View user's profile Send private message  
DWho [ Sat 14 Feb, 2009 13:50 ]
Reply with quote    Download Post  
Post 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 which php code ????



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 14:13 ]
Reply with quote    Download Post  
Post 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..

   



 
DWho - View user's profile Send private message  
DWho [ Sat 14 Feb, 2009 17:40 ]
Reply with quote    Download Post  
Post Re: User Block Mod 
 
one question .

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

looks a bit big for me



 
spydie - View user's profile Send private message  
spydie [ Sat 14 Feb, 2009 18:31 ]
Reply with quote    Download Post  
Post 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..

   



       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



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 19:43 ]
Reply with quote    Download Post  
Post 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...?



 
DWho - View user's profile Send private message  
DWho [ Sat 14 Feb, 2009 20:08 ]
Reply with quote    Download Post  
Post 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            



 
n1cks21 - View user's profile Send private message  
n1cks21 [ Sat 14 Feb, 2009 22:49 ]
Display posts from previous:    

HideWas this topic useful?

Post new topic  Reply to topic  Page 1 of 4
Goto page 1, 2, 3, 4  Next
 




 


 

cron