1
xtreme
Can i Show a Avatar in user Menu
  • 2004/4/14 12:17

  • xtreme

  • Just popping in

  • Posts: 22

  • Since: 2003/10/4


Can i show the avatar from the user in the User Menu, and can 1 let vote on users ?

2
karuna
Re: Can i Show a Avatar in user Menu
  • 2004/4/14 14:24

  • karuna

  • Not too shy to talk

  • Posts: 171

  • Since: 2002/5/29


Hi

to show a avatar in user Menu u can modife the system_block in the modules/system/block/
about line 145
function b_system_user_show()
{
    global 
$xoopsUser;
    if (
is_object($xoopsUser)) {
        
$pm_handler =& xoops_gethandler('privmessage');
        
$block = array();
        
$block['lang_youraccount'] = _MB_SYSTEM_VACNT;
        
$block['lang_editaccount'] = _MB_SYSTEM_EACNT;
        
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
        
$block['uid'] = $xoopsUser->getVar('uid');
        
$block['lang_logout'] = _MB_SYSTEM_LOUT;
        
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
        
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
        
$block['new_messages'] = $pm_handler->getCount($criteria);
        
$block['lang_inbox'] = _MB_SYSTEM_INBOX;
        if (
$xoopsUser->isAdmin()) {
            
$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
        }
        
/////////here add these///////////////
        
$block['avatar'] = $xoopsUser->getVar('user_avatar') != 'blank.gif' XOOPS_URL.'/uploads/'.$xoopsUser->getVar('user_avatar') : ''
        
/////////end//////////////////////////
        
return $block;
    }
    return 
false;
}


then u can use <{$block.avatar}> to get the user's avatar



3
kymseen
Re: Can i Show a Avatar in user Menu
  • 2006/10/5 14:19

  • kymseen

  • Just popping in

  • Posts: 23

  • Since: 2006/9/11


hello, this worked great for me!

Although one problem! default avatar, blank.gif doesn't show up...
does anyone know how to fix this??


In the same system_block.php there is the code for user ranking
Quote:
function b_system_topposters_show($options)
{
$block = array();
$criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
$limit = (!empty($options[0])) ? $options[0] : 10;
$size = count($options);
for ( $i = 2; $i < $size; $i++) {
$criteria->add(new Criteria('rank', $options[$i], '<>'));
}
$criteria->setOrder('DESC');

// $criteria->setSort('posts');

$criteria->setLimit($limit);
$member_handler =& xoops_gethandler('member');
$topposters =& $member_handler->getUsers($criteria);
$count = count($topposters);
for ($i = 0; $i < $count; $i++) {
$block['users'][$i]['rank'] = $i+1;
if ( $options[1] == 1 ) {
$block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL.'/'.$topposters[$i]->getVar('user_avatar') : '';
} else {
$block['users'][$i]['avatar'] = '';
}
$block['users'][$i]['id'] = $topposters[$i]->getVar('uid');
$block['users'][$i]['name'] = $topposters[$i]->getVar('uname');
$block['users'][$i]['posts'] = $topposters[$i]->getVar('posts');
}
return $block;
}


and it shows the default avatar blank.gif just fine.

but this code doesn't
Quote:
$block['avatar'] = $xoopsUser->getVar('user_avatar') != 'blank.gif' ? XOOPS_URL.'/uploads/'.$xoopsUser->getVar('user_avatar') : '';


What's wrong???

please help figure this little problem out!

4
kymseen
Re: Can i Show a Avatar in user Menu
  • 2006/10/5 23:48

  • kymseen

  • Just popping in

  • Posts: 23

  • Since: 2006/9/11


I couldn't figure out what was wrong but I found a simislar code and got it!

I put in

Quote:
<{if $block.avatar != ""}>


<{else}>


<{/if}>


in system_user_block.html

and it showed up fine!

Login

Who's Online

463 user(s) are online (367 user(s) are browsing Support Forums)


Members: 0


Guests: 463


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