11
phppp
Re: User Avatar in theme.html
  • 2004/4/19 19:08

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


sorry for the mistake

NeoPlug'avatar:<{$NeoPlug_avatar}>

12
NeoPlug
Re: User Avatar in theme.html
  • 2004/4/19 20:53

  • NeoPlug

  • Just popping in

  • Posts: 18

  • Since: 2004/4/18


But where do i have to add all that code ? in my header ? and do i have to add it somewhere particularly in the file ?

13
phppp
Re: User Avatar in theme.html
  • 2004/4/19 20:57

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


anywhere before $xoopsTpl->display()

14
NeoPlug
Re: User Avatar in theme.html
  • 2004/4/19 22:03

  • NeoPlug

  • Just popping in

  • Posts: 18

  • Since: 2004/4/18


Could you show me an example file if it's not too much asked plz ? cuz i still get a blank page so i guess i did something wrong unless there's another mistake somewhere ....

Thank you very much for ur help!

15
phppp
Re: User Avatar in theme.html
  • 2004/4/19 22:10

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25




just as an example:
before the last line in header.php:

$NeoPlug_avatar $XoopsUser->getVar('user_avatar');
if(
file_exists(XOOPS_ROOT_PATH.'/uploads/'.$NeoPlug_avatar))
$NeoPlug_avatar '.XOOPS_URL.'/uploads/'.$NeoPlug_avatar.'">';
else 
$NeoPlug_avatar='';

$xoopsTpl->assign("NeoPlug_avatar",$NeoPlug_avatar)


in the theme.html
display NeoPlug'avatar:<{$NeoPlug_avatar}>


:: sorry, edited

16
phppp
Re: User Avatar in theme.html
  • 2004/4/19 22:12

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


test it asap, I gonna leave ...

17
NeoPlug
Re: User Avatar in theme.html
  • 2004/4/19 22:34

  • NeoPlug

  • Just popping in

  • Posts: 18

  • Since: 2004/4/18


Yay it works! Thank you phppp and all of u guyz that helped me doing this. The code didn't work cuz of a little mistake (an extra bracket actually).
Here is the code for those who would need to do the same :

Paste it right before "?>" in the last line of header.php
Quote:
$NeoPlug_avatar = $xoopsUser->getVar('user_avatar');
if(file_exists(XOOPS_ROOT_PATH.'/uploads/'.$NeoPlug_avatar))
$NeoPlug_avatar = 'src="'.XOOPS_URL.'/uploads/'.$NeoPlug_avatar.'">';
else $NeoPlug_avatar='';

$xoopsTpl->assign("NeoPlug_avatar",$NeoPlug_avatar)

Then modify theme.html (themes/yourtheme/theme.html) and add this where you want the user avatar to be displayed.
Quote:
<{$NeoPlug_avatar}>

18
NeoPlug
Re: User Avatar in theme.html
  • 2004/4/20 9:36

  • NeoPlug

  • Just popping in

  • Posts: 18

  • Since: 2004/4/18


I just figured out there is a problem councerning guests. It seems like the hack doesn't take into account users who aren't logged in cuz logged out users get a blank page. Can some1 help me ?

19
Dave_L
Re: User Avatar in theme.html
  • 2004/4/20 11:49

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Try:

if (is_object($xoopsUser)) {
   
$NeoPlug_avatar $xoopsUser->getVar('user_avatar');
   if (
file_exists(XOOPS_ROOT_PATH.'/uploads/'.$NeoPlug_avatar)) { 
      
$NeoPlug_avatar 'src="'.XOOPS_URL.'/uploads/'.$NeoPlug_avatar.'" alt="avatar" />';
   } else {
      
$NeoPlug_avatar '';
} else {
   
$NeoPlug_avatar '';
}

$xoopsTpl->assign('NeoPlug_avatar'$NeoPlug_avatar)


If that doesn't solve the problem, turn on PHP debug.

20
phppp
Re: User Avatar in theme.html
  • 2004/4/20 12:45

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Let's make this more perfect [/quote] ...
Quote:

if (is_object($xoopsUser)) {
$NeoPlug_avatar = $xoopsUser->getVar('user_avatar');
if (file_exists(XOOPS_ROOT_PATH.'/uploads/'.$NeoPlug_avatar)) {
$NeoPlug_avatar = 'src="'.XOOPS_URL.'/uploads/'.$NeoPlug_avatar.'" alt="avatar" />';
} else {
$NeoPlug_avatar = '';
} else {
$NeoPlug_avatar = 'src="'.XOOPS_URL.'/uploads/NeoPlug_portait.jpg" alt="avatar" />';
}

$xoopsTpl->assign('NeoPlug_avatar', $NeoPlug_avatar)

Login

Who's Online

340 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 340


more...

Donat-O-Meter

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

Latest GitHub Commits