21
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.



22
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:


<table cellspacing="1" class="outer">
<{foreach item=user from=$block.users}>
<tr class="<{cycle values="even,odd"}>" valign="middle">
<td align="center">
<{if $user.avatar != ""}>
<img src="<{$user.avatar}>" alt="" width="32" /><br />
<{/if}>
<a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name}></a>
</td>
<td align="center"><{$user.joindate}></td>
</tr>
<{/foreach}>
</table>


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



23
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.



24
cesser
Re: A way to display last login date in a user list?
  • 2004/12/9 15:54

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


That worked Dave_L!

Thank you very much for the help!



25
cesser
Re: A way to display last login date in a user list?
  • 2004/12/9 15:02

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


I must still be missing something here.

Here is the default code for the system_block_newusers.html template:

Quote:
<table cellspacing="1" class="outer">
<{foreach item=user from=$block.users}>
<tr class="<{cycle values="even,odd"}>" valign="middle">
<td align="center">
<{if $user.avatar != ""}>
<img src="<{$user.avatar}>" alt="" width="32" /><br />
<{/if}>
<a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name}></a>
</td>
<td align="center"><{$user.joindate}></td>
</tr>
<{/foreach}>
</table>



Shouldn't I just be able to substitute <{$user_lastlogin}> in the code above in place of <{$user.joindate}> as in the example below:

Quote:
<table cellspacing="1" class="outer">
<{foreach item=user from=$block.users}>
<tr class="<{cycle values="even,odd"}>" valign="middle">
<td align="center">
<{if $user.avatar != ""}>
<img src="<{$user.avatar}>" alt="" width="32" /><br />
<{/if}>
<a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name}></a>
</td>
<td align="center"><{$user_lastlogin}></td>
</tr>
<{/foreach}>
</table>



Whenever I try to do that, only the username is returned, not the last login time.

What am I doing wrong?

Sorry for the "rookieness" and thanks again.



26
cesser
A way to display last login date in a user list?
  • 2004/12/9 5:15

  • cesser

  • Just popping in

  • Posts: 26

  • Since: 2004/3/21


Hi everyone

I've been working with XOOPS off and on for the past year, but only recently have really gotten into it and I think it's great.

I'm currently working on a new website and I wanted to know if it is possible to generate a block similar to the New Members system block, but have it display the last login time for each user instead of the join date. I've been pulling my hair out for the last couple hours trying to possibly get this to work, but no luck. I tried taking the New Users template html code and putting it into a custom block in order to manipulate it, but when I do that, the output is just a bunch of garbled code. Not sure what I am doing wrong. Maybe I don't understand the concept of the template process. I have already cloned the default template set. How do I then clone, say, the New Users block so that I can change it how I wish? Assuming that is accomplished, what variable would I call in the html code in order to display last login time? I thought it would be either last_login or lastlogin, but neither of those seem to be it.

Forgive my ignorance, just starting out here for the most part. I would really appreciate any help on this one.

Thanks in advance.




TopTop
« 1 2 (3)



Login

Who's Online

168 user(s) are online (85 user(s) are browsing Support Forums)


Members: 0


Guests: 168


more...

Donat-O-Meter

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

Latest GitHub Commits