1
cesser
How to enable avatar display?
  • 2004/12/10 0:52

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


Hi everyone

I copied the New Members system block template code over the Waiting Contents block template (since I wasn't going to use that block) so that I now have two New Members blocks (which is what I wanted - don't ask why )

Anyway, both blocks are working fine, except that I can't get avatars to display on the Waiting Contents customized block that I set up. When you go into the block edit for the original New Members block, there is an option where you can choose to display avatar images. The Waiting Contents block doesn't have this option during Edit obviously, since I put in my own code there. Is there a way that I can enable the avatars to display on my new block since that option isn't available?

Thanks in advance.

2
brash
Re: How to enable avatar display?
  • 2004/12/10 1:02

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Can you post your custom code?

3
cesser
Re: How to enable avatar display?
  • 2004/12/10 1:11

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


It isn't really custom. I just copied the New Members block temlate code over the Waiting Contents block template code:



<{foreach item=user from=$block.users}>
" valign="middle">



<{/foreach}>

<{if $user.avatar != ""}>


<{/if}>
<{$user.name}>
<{$user.joindate}>



I then edited the system_blocks.php file, replacing the function b_system_waiting_show() section with the code from the function b_system_newmembers_show($options) section:

{
$block = array();
$criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
$limit = (!empty($options[0])) ? $options[0] : 10;
$criteria->setOrder('DESC');
$criteria->setSort('user_regdate');
$criteria->setLimit($limit);
$member_handler =& xoops_gethandler('member');
$newmembers =& $member_handler->getUsers($criteria);
$count = count($newmembers);
for ($i = 0; $i < $count; $i++) {
if ( $options[1] == 1 ) {
$block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL.'/'.$newmembers[$i]->getVar('user_avatar') : '';
} else {
$block['users'][$i]['avatar'] = '';
}
$block['users'][$i]['id'] = $newmembers[$i]->getVar('uid');
$block['users'][$i]['name'] = $newmembers[$i]->getVar('uname');
$block['users'][$i]['joindate'] = formatTimestamp($newmembers[$i]->getVar('user_regdate'), 's');
}
return $block;
}


Both blocks display fine, only the Waiting Contents block (with the New Members code in it) doesn't display the avatars, only the username and the join date. I just need to know how the original New Members block, using the same code as the other, winds up displaying the avatars. The option is there in the New Members block to display avatars, while none exists in the Waiting Contents block (since that wasn't the original purpose of the block).

If it isn't possible to display the avatars when doing something like this, I'm cool with that. Just would like to know if I could make it happen though.

Thanks

4
brash
Re: How to enable avatar display?
  • 2004/12/10 1:23

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Can you view the source of your custom block and paste it here. For future reference, to duplicate a block it is much easier to just edit the xoops_version.php. In this case you'd edit /modules/system/xoops_version.php and add another block for top posters.

5
cesser
Re: How to enable avatar display?
  • 2004/12/10 1:52

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


I'm intrigued by the xoops_version.php method (didn't know about that).

I tried it, but I don't see another block appear in the blocks list. When I edit the file, how exactly do I add the new block? I tried to copy and paste the original Recent Users block code:

$modversion['blocks'][9]['file'] = "system_blocks.php";
$modversion['blocks'][9]['name'] = _MI_SYSTEM_BNAME10;
$modversion['blocks'][9]['description'] = "Shows most recent users";
$modversion['blocks'][9]['show_func'] = "b_system_newmembers_show";
$modversion['blocks'][9]['options'] = "10|1";
$modversion['blocks'][9]['edit_func'] = "b_system_newmembers_edit";
$modversion['blocks'][9]['template'] = 'system_block_newusers.html';



to the end of the file, then changed all of the 9's to the next available number (13). I guess that isn't the way to do it. What else do I need to change?

Thanks.

6
brash
Re: How to enable avatar display?
  • 2004/12/10 2:06

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Actually, you'll need to edit xoops_version.php AND modinfo.php from under the /modules/system/language/{your_language}/

7
cesser
Re: How to enable avatar display?
  • 2004/12/10 2:39

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


Ok, I added this line to the modinfo.php file:

define('_MI_SYSTEM_BNAME14', "Last Login Times");

and this section to the xoops_version.php:

$modversion['blocks'][13]['file'] = "system_blocks.php";
$modversion['blocks'][13]['name'] = _MI_SYSTEM_BNAME14;
$modversion['blocks'][13]['description'] = "Shows last login time for all users";
$modversion['blocks'][13]['show_func'] = "b_system_newmembers_show";
$modversion['blocks'][13]['options'] = "10|1";
$modversion['blocks'][13]['edit_func'] = "b_system_newmembers_edit";
$modversion['blocks'][13]['template'] = 'system_block_newusers.html';


I still don't see a new block in the blocks list. Did I miss something?

Login

Who's Online

417 user(s) are online (373 user(s) are browsing Support Forums)


Members: 0


Guests: 417


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