1
Bowromir
member Avatar display in custom block ?
  • 2005/7/11 16:15

  • Bowromir

  • Just popping in

  • Posts: 19

  • Since: 2004/9/8 2


Hi Xoopsers,

I can't seem to figure out how to display a user's personal avatar in a custom made block. Like for example the right block in this site.. you can see the avatar's of the Top Posters. I want people to see there own avatar when they login on my site. And put it in a custom made block. Example:

(Avatar)
Edit Profile
My Inbox
Logout

Does anyone know the right code for this ? all help is much apreciated !

Greetz,

Bowromir

2
LazyBadger
Re: member Avatar display in custom block ?

Check code of IStats block - it can show logged user's avatar (if any)
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

3
Bowromir
Re: member Avatar display in custom block ?
  • 2005/7/11 23:33

  • Bowromir

  • Just popping in

  • Posts: 19

  • Since: 2004/9/8 2


can you be a bit more specific.. :S

4
Bowromir
Re: member Avatar display in custom block ?
  • 2005/7/13 12:39

  • Bowromir

  • Just popping in

  • Posts: 19

  • Since: 2004/9/8 2


Anyone ? common this can't be so hard ? :S

5
davidl2
Re: member Avatar display in custom block ?
  • 2005/7/13 12:44

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


Hmmm - it shouldnt be hard, and i think this could be a nice little custom block as well :)

6
Bowromir
Re: member Avatar display in custom block ?
  • 2005/7/13 18:47

  • Bowromir

  • Just popping in

  • Posts: 19

  • Since: 2004/9/8 2


Yeps.. I tried all kinds of things but im not really a php/smary expert

7
LazyBadger
Re: member Avatar display in custom block ?

I can't also write good PHP|Smarty code! but I can
- think
- read
- copy/paste code-snippets
- understand XOOPS basis
- use common sense

Results:
1. I found file (data preparation for block), function in it and template for user menu (by reading xoops_version.php from System Module)
They are: system_blocks.php(modules/system/blocks/system_blocks.php), function b_system_user_show(), template system_block_user.html

2. From IStats copy-paste code into function b_system_user_show() (from it's block function) and slightly changed smarty-variable name (don't ask, why changed...)

global $xoopsUser;
if (
is_object($xoopsUser)) {
    
$block['uavatar'] = $xoopsUser->getVar('user_avatar');
    if (
file_exists(XOOPS_ROOT_PATH.'/uploads/'.$block['uavatar'])) { 
        
$block['uavatar'] = '.XOOPS_URL.'/uploads/'.$block['uavatar'].'" alt="avatar" />';
    }else{
        
$block['uavatar'] = '';
        }

3. Cloned templateset, edit system_block_user.html and add new smarty-variable <{$block.uavatar}> into needed place of template
4. Update module System
5. Have fun
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

8
Bowromir
Re: member Avatar display in custom block ?
  • 2005/7/14 15:54

  • Bowromir

  • Just popping in

  • Posts: 19

  • Since: 2004/9/8 2


I've put the following code into blocks/system_blocks.php but it

global $xoopsUser;
if (is_object($xoopsUser)) {
$block['uavatar'] = $xoopsUser->getVar('user_avatar');
if (file_exists(XOOPS_ROOT_PATH.'/uploads/'.$block['uavatar'])) {
$block['uavatar'] = 'avatar';
}else{
$block['uavatar'] = '';
}

And I've put the smarty tag <{$block.uavatar}> in the html template.. updated the system etc.. but it doesn't work. Could you please send me both files (if you have them) 2 my email (bowromir@gmail.com) or display them here entirely ? Your help is much apreciated

9
LazyBadger
Re: member Avatar display in custom block ?

Can you enable smarty-debug and show it's output for block-in-question?
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

10
Abdel
Re: member Avatar display in custom block ?
  • 2005/7/14 17:20

  • Abdel

  • Just popping in

  • Posts: 3

  • Since: 2005/7/7 1


Could you please send me also the files to abdel@maroc.nu thanks, my xoops-friend

Login

Who's Online

553 user(s) are online (414 user(s) are browsing Support Forums)


Members: 0


Guests: 553


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