1
chrisman1
User Avatar within theme template
  • 2005/4/28 16:23

  • chrisman1

  • Just popping in

  • Posts: 5

  • Since: 2005/4/6 1


Is there a way that when a user logs into the site, that his or her Avatar will show up in within the head of the theme. lets say in the right hand upper corner. I have been playing with this but with no luck.

2
talunceford
Re: User Avatar within theme template

Yeah, but you have to customize the header.php file to get it to work. Basically you need to make a db call that will fetch the users avatar, then write it to a smarty variable which can be used in your theme. Ive done it with excellent luck. If you would like, I could look into modifying the header for you so that you could do it.

The site that I've done is on is my bf2online site. It does what you are asking in another way. It takes the users rank and applies it in a way that will display the users rank in a string of text next to the username along with a country of origin flag. It also changes the header image based on rank. Essentially, its the same principal.

Just let me know.

3
Mithrandir
Re: User Avatar within theme template

Or - a custom (PHP) block visible on all pages with this content:

global $xoopsTpl$xoopsUser;
if (
$xoopsUser) {
    
$xoopsTpl->assign('user_avatar'$xoopsUser->getVar('user_avatar'));
}


Then you can put this in your theme:

<{if $user_avatar}>
    <
img src="<{$xoops_upload_url}>/<{$user_avatar}>" alt="Avatar" />
<{/if}>


where you want the avatar to show up.

4
LazyBadger
Re: User Avatar within theme template

Or (repet myself) - change nothing in header.php, doesn't add any php code outside theme, simply install Suin's smarty plugin and write in theme instead of username (wrapped by if)

src="<{$xoops_upload_url}>/{xoops_uid|suin_user:"user_avatar"}>"

5
chrisman1
Re: User Avatar within theme template
  • 2005/4/28 18:53

  • chrisman1

  • Just popping in

  • Posts: 5

  • Since: 2005/4/6 1


Hay thanks all I went with Mithrandir's idea and it worked great, very simple and stright forward. Thanks for your great help with this one.

Login

Who's Online

476 user(s) are online (145 user(s) are browsing Support Forums)


Members: 0


Guests: 476


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits