How to add user avatar in overall header??

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
denizdnr
Registered User
Posts: 6
Joined: Tue Jul 17, 2007 12:05 am

How to add user avatar in overall header??

Post by denizdnr »

Hello,

I am trying to make a little welcome panel and when user login, i want to show his/her username and avatar on overall header. i did username.. but i cannot show avatar ? Which code i have to add page_header.php or other phps?
User avatar
dellsystem
Former Team Member
Posts: 3879
Joined: Sat Apr 09, 2005 8:54 pm
Location: Montreal
Name: Wendy
Contact:

Re: How to add user avatar in overall header??

Post by dellsystem »

(Moved to MOD Writers)

Taken from AbelaJohnB's avatar on index MOD.

Add in page_header.php

$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}

before (in the line above)

Code: Select all

 $template->assign_vars(array(
. And then after the above code add

Code: Select all

        'AVATAR_IMG' => $avatar_img,
and then in overall_header.tpl just add {AVATAR_IMG} somewhere.

You may also wish to take a look at that MOD for how to add a link to the username.
Former moderator and website team member | My MODs, and more (GitHub)
Post Reply

Return to “[2.0.x] MOD Writers Discussion”