Back to vBulletin 3.0 Add-Ons

List of new members during last 24h
Mod Version: 1.02, by Olsufr

This modification is in the archives.
vB Version: 3.0.6 Rating: (0 vote - 0 average) Installs: 14
Released: 13 Feb 2005 Last Update: 23 Mar 2005 Downloads: 3
Not Supported  

Simple hack to display new registered members during last 24 hours.

A very simple display of all members who have registered in the forum during last 24 hours.

It displays statistics and the list of new registered members (last 24h) on Forum Home
under the "Users online" display.

The list is now in chronological order (newest first, oldest last).

example:
" Welcome to our newest members: (18) name18, name17, name16, name15, name14, name13, name12, name11, name10, name9, name8, name7, name6, name5, name4, name3, name2, name1 "

There is no additional SQL query.

----------------------------------

Installation (there is in attached file)

Step 1

In includes/functions_databuild.php

Find:

PHP Code:
// ###################### Start saveuserstats #######################
// Save user count & newest user into template
function build_user_statistics()
{
    global 
$vboptions$DB_site;

    
// get total members
    
$members $DB_site->query_first("SELECT COUNT(*) AS users, MAX(userid) AS max FROM " TABLE_PREFIX "user");

    
// get newest member
    
$newuser $DB_site->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid = $members[max]");

    
// make a little array with the data
    
$values = array(
        
'numbermembers' => $members['users'],
        
'newusername' => $newuser['username'],
        
'newuserid' => $newuser['userid']
    );

    
// update the special template
    
build_datastore('userstats'serialize($values));


And replace by this code:

PHP Code:
// ###################### Start saveuserstats #######################
// Save user count & newest user into template
// Function is modified by Oleg Subel for STATISTICS AND LIST OF NEW REGISTERED MEMBERS 24h
function build_user_statistics()
{
    global 
$vboptions$DB_site;

    
// get total members
    
$members $DB_site->query_first("SELECT COUNT(*) AS users, MAX(userid) AS max FROM " TABLE_PREFIX "user");

    
// get last newest members 24h
    
$cattime24 TIMENOW 24 60 60;
    
$newusers $DB_site->query("SELECT joindate, userid, username FROM " TABLE_PREFIX "user WHERE joindate > $cattime24");
//    $newuser = $DB_site->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid = $members[max]");

    
$newusers24 = array();
    while (
$newuser $DB_site->fetch_array($newusers))
    {
        
$newusers24["{$newuser['joindate']}"] = array('id' => $newuser['userid'], 'name' => $newuser['username']);
    }
    
// reverse sort keys
    
krsort($newusers24);

    if (empty(
$newusers24[0]))
    {
        
$lastnewuser $DB_site->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid = $members[max]");
    }

    
// make a little array with the data
    
$values = array(
        
'numbermembers' => $members['users'],
        
'newusername' => ( (empty($newusers24[0])) ? $lastnewuser['username'] : $newusers24[0]['name'] ),
        
'newuserid' => ( (empty($newusers24[0])) ? $lastnewuser['userid'] : $newusers24[0]['id'] ),
        
'lastregusers24h' => $newusers24
    
);

    
// update the special template
    
build_datastore('userstats'serialize($values));


Step 2

In index.php

Find:

PHP Code:
// get total members and newest member from template
$userstats unserialize($datastore['userstats']);
$numbermembers vb_number_format($userstats['numbermembers']);
$newusername $userstats['newusername'];
$newuserid $userstats['newuserid']; 
And insert this code below:

PHP Code:
// ### STATISTICS AND LIST OF NEW REGISTERED MEMBERS 24h by Oleg Subel ####################

$lastregusers24 $userstats['lastregusers24h'];
$numbernewregusers24 0;
$newusers24 '';
$cattime24 TIMENOW 24 60 60;
if (
is_array($lastregusers24) && count($lastregusers24) > 0)
{
    foreach(
$lastregusers24 AS $regjoindate => $regnewuser)
    {
        if (
$regjoindate $cattime24)
        {
            
$numbernewregusers24++;
            eval(
'$newusers24 .= ", ' fetch_template('forumhome_regnewuser') . '";');
        }
    }
}
$newusers24 substr($newusers24 2); // get rid of initial comma

// ### End of STATISTICS AND LIST OF NEW REGISTERED MEMBERS 24h by Oleg Subel ############# 
Step 3

Add new phrase

Phrase Type: GLOBAL
Varname: welcome_to_our_newest_members
Text:
Code:
Welcome to our newest members

Step 4

Add new template (Title: forumhome_regnewuser):

Code:
<a href="member.php?$session[sessionurl]u=$regnewuser[id]">$regnewuser[name]</a>
Step 5

FORUMHOME template modification

Find:

Code:
			<div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>
and replace with:

Code:
			<if condition="$numbernewregusers24"><div>$vbphrase[welcome_to_our_newest_members]: ($numbernewregusers24) $newusers24</div></if>

END

Now, if you want to have statistics more than for 24 hours (for example - 3 days)
you need:

1) to change line of this hack for includes/functions_databuild.php (see step 1 of installation):
PHP Code:
$cattime24 TIMENOW 24 60 60
to
PHP Code:
$cattime24 TIMENOW 324 60 60
and

2) to change line of this hack for index.php (see step 2 of installation):
PHP Code:
$cattime24 TIMENOW 24 60 60
to
PHP Code:
$cattime24 TIMENOW 324 60 60

Download

This modification is archived and cannot be downloaded.

Screenshots

 


vblts.ru supports vBulletin®, 2022-2024