4
I don't know what XOOPS version do you use, but probably it's XOOPS 2.0.x so i downloaded that version :)
File: modules\system\blocks\system_blocks.php
Lines: from 267 to 289
Now there is such code:
function b_system_newmembers_show($options)
{
$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;
}
You should change this function into:
function b_system_newmembers_show( $options ) {
/**
* XOOPS database object
*/
$xoopsDB =& Database::getInstance();
/**
* Old block
*/
$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');
}
/**
* Get time for query (we use here 24hours)
*/
$time = time() - 24*3600;
/**
* SQL query
*/
$sql = "SELECT COUNT( last_login ) AS count FROM " . $xoopsDB->prefix( 'user_profile' ) . " WHERE last_login >= '" . $time . "'";
/**
* Get results
*/
list( $count ) = $xoopsDB->fetchRow( $xoopsDB->query( $sql ) );
/**
* Assign results to return variable
*/
$block['users_in_last_24_hours'] = intval( $count );
return $block;
}
And now in your template (modules\system\templates\blocks\system_block_newusers.html) you have a new variable
<{$block.users_in_last_24_hours}> and you can put it anywhere you like.
P.S.
Sorry, but i was too lazy to test this function :) i believe that it works, but i cant assure you Good luck,
teibaz