vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Members who have registered today (https://vborg.vbsupport.ru/showthread.php?t=72972)

ericgtr 12-15-2004 10:00 PM

Members who have registered today
 
I was going to add this to my existing vbindex stats mod but it's a little too different so I will post it up as a new one, this has been requested a few times in the short time I have been here.

Update, corrected: Originally had forumindex.php when it should be index.php

What it does:
Adds a Registered Today (how many users in the last 24 hours) to the statistics on the forum index.

Modifications:
1 Template
1 File
1 Phrase

Add a phrase:
Global
Varname: reged_today
Text: Registered Today

In index.php find:

PHP Code:

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### 

Above it add:

PHP Code:

// ### Registered Today ##
$newusers $DB_site->query_first('
SELECT COUNT(*) AS count 
FROM ' 
TABLE_PREFIX 'user
WHERE joindate >= "' 
strtotime("-1day") . '"
'
);
$newmembers number_format($newusers['count']);
// ### Registered Today ## 

In your FORUMHOME template find:

Code:

                        <div>$vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
Change it to (or maker the proper addition as shown):

Code:

                        <div>$vbphrase[reged_today]: $newusers[count], $vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
Update: Paul M has worked this out to start at midnight, instead of just the last 24 hrs here https://vborg.vbsupport.ru/showpost....5&postcount=18


That's it, I am supporting this please click install if you find it useful :)

HarryBO 12-16-2004 06:25 PM

Very nice Hack! Big Thx!

ACentral 12-16-2004 07:19 PM

Very nice! It worked right away for me.

For most people it'll be forum/index.php as the file to edit, not forumindex.php

ericgtr 12-16-2004 07:31 PM

Quote:

Originally Posted by ACentral
Very nice! It worked right away for me.

For most people it'll be forum/index.php as the file to edit, not forumindex.php

Thanks, I was thinking about that on my way in too. Corrected.

Socomjunky.com 12-16-2004 08:09 PM

Just Installed hack right now, www.socomjunky.com/forum very nice edition

N8 12-24-2004 04:25 AM

Also displaying the names of the users who have registered would be cool :)

Sports.N.Cards 12-28-2004 01:01 PM

Just adding thanks!

calvinnguyen 12-29-2004 08:04 AM

just adding. thanks ericgtr!

psico 12-29-2004 01:10 PM

Excelent work! Tnx!

lange 01-02-2005 03:34 PM

Thanks.

MajorFm.com 01-23-2005 09:38 PM

exactly what i was looking for...! thanks

MajorFm.com 01-27-2005 10:17 PM

Is it possible to have it reset at midnight? so it shows the users registered that day rather then the last 24 hours...

Marco van Herwaarden 01-28-2005 03:19 AM

Midnight for who? The server, you, or a member living in another timezone?

MustangLisa 01-28-2005 06:58 PM

Cool, thanks!!

http://www.blackmustangclub.com/forum/index.php?

Okiewan 01-29-2005 11:12 AM

Quote:

Originally Posted by MarcoH64
Midnight for who? The server, you, or a member living in another timezone?

The server please!!

MajorFm.com 01-29-2005 11:51 AM

Quote:

Originally Posted by MarcoH64
Midnight for who? The server, you, or a member living in another timezone?

Midnight for the timezone the admin has chosen as default in ACP, e.g. mine is set to 0 GMT, other users might have it set diffrent, i have the members visited today hack aswell and this uses that...

Thank You

ericgtr 01-29-2005 12:27 PM

Edit: oops wrong query.

Paul M 01-29-2005 12:51 PM

Quote:

Originally Posted by ericgtr
I tried changing the query to this which is partially borrowed from PaulM's code and should show who has registered since midnight:


and I get the exact same results as I do with my code.

Hmm, I doubt you do, not with what you have posted anyway.

This should work ;

PHP Code:

// Who Regeistered Today - using Paul Marsden's code
$now TIMENOW ;
require_once(
'./includes/functions_misc.php');
$cutoff vbmktime(000vbdate('m'$nowfalsefalse), vbdate('d'$nowfalsefalse), vbdate('Y'$nowfalsefalse));
// $cutoff = $now - 86400 ;  // Uncomment this line if you want a rolling last 24 hours.
$newusers $DB_site->query_first('
SELECT COUNT(*) AS count 
FROM ' 
TABLE_PREFIX 'user
WHERE joindate >= ' 
.$cutoff'
'
);
$newmembers number_format($newusers['count']);
// Who Regeistered Today - using Paul Marsden's code 

Edit: Updated with bug fixes from subsequent posts.

MajorFm.com 01-29-2005 01:19 PM

I dont think that works as i know get a blank space where the number should be

http://www.majorfm.com/forum/

Boofo 01-29-2005 01:23 PM

Does this count the registrations in the last 24 hours or since midnight for each user?

MajorFm.com 01-29-2005 01:40 PM

Thats what we are tryin to do now, the original hack does the last 24 hours, we are tryin to make it so it counts from midnight.

Boofo 01-29-2005 01:50 PM

Paul's code in post 18 will do that. ;)

ericgtr 01-29-2005 01:51 PM

Yep, you are right Boofoo it works. Thanks Paul! :) and sorry for posting the wrong query up there guys I have to learn to label my code better in my index.php.

MajorFm.com 01-29-2005 02:03 PM

ok it works for you guys, im gettin a blank spot for some reason... i assume this will work when my forum passes midnight maybe..

ericgtr 01-29-2005 02:11 PM

You should still get a value of zero, I just registered and it still doesn't show. Try pasting it Paul's code above exactly if you haven't already I just tested on my site and it works.

MajorFm.com 01-29-2005 02:31 PM

i pasted that exactly replacing your original code... strange...

The segment in my index.php looks like this

Code:

        {
                $getstats_thread[isdeleted] = true;
        }
        eval('$stats_threads .= "' . fetch_template('forumhome_stats_thread') . '";');
}
// Who Regeistered Today - using Paul Marsden's code
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
// $cutoff = $now - 86400 ;  // Uncomment this line if you want a rolling last 24 hours.
$whousers = $DB_site->query_first('
SELECT COUNT(*) AS count
FROM ' . TABLE_PREFIX . 'user
WHERE joindate >= " .$cutoff. "
');
$newmembers = number_format($whousers['count']);
// Who Regeistered Today - using Paul Marsden's code
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
eval('$vbpopup = "' . fetch_template('forumhome_vbpopup') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('FORUMHOME') . '");');


MajorFm.com 01-29-2005 08:05 PM

Any idea? i still get a blank spot..

Paul M 01-29-2005 08:29 PM

Quote:

Originally Posted by MajorFm.com
Any idea? i still get a blank spot..

Yeah, actually, it might be a small error in what I posted above - I notice a couple of of the quotation marks are doubles, when they ought to be singles (it was done in a hurry ;));

The two to change are hilighted below (on the WHERE line) ;


Code:

        {
                $getstats_thread[isdeleted] = true;
        }
        eval('$stats_threads .= "' . fetch_template('forumhome_stats_thread') . '";');
}
// Who Regeistered Today - using Paul Marsden's code
require_once('./includes/functions_misc.php');
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
// $cutoff = $now - 86400 ;  // Uncomment this line if you want a rolling last 24 hours.
$whousers = $DB_site->query_first('
SELECT COUNT(*) AS count
FROM ' . TABLE_PREFIX . 'user
WHERE joindate >= " .$cutoff. "
');
$newmembers = number_format($whousers['count']);
// Who Regeistered Today - using Paul Marsden's code
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
eval('$vbpopup = "' . fetch_template('forumhome_vbpopup') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('FORUMHOME') . '");');

Change them both to single quote marks ;

Code:

WHERE joindate >= ' .$cutoff. '
:)

MajorFm.com 01-29-2005 08:35 PM

I did this, still a blank... :-(

Paul M 01-29-2005 08:58 PM

Hmm, I'm not sure how I've ended up supporting someone elses hack ;) - but yes, I can see the problem.

In the code I posted, change

PHP Code:

$whousers $DB_site->query_first(

to

PHP Code:

$newusers $DB_site->query_first(

and it should work.

The reason is that the line changed in the FORUMHOME template is using the array value, not the subsequently created $newmembers variable;

Code:

<div>$vbphrase[reged_today]: $newusers[count], $vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
This would appear to be an oversight by the hack author. :)

MajorFm.com 01-29-2005 09:06 PM

Quote:

Originally Posted by Paul M
Hmm, I'm not sure how I've ended up supporting someone elses hack ;)

yer i know but it is appreciated, that works fine, thanks :squareeyed:

Thug 02-07-2005 08:09 PM

mine doesnt reset every 24hours
it adds on and on over the days
and 2day it went from 28 register to 25 on its own
please help

ericgtr 02-07-2005 08:22 PM

Quote:

Originally Posted by Thug
mine doesnt reset every 24hours
it adds on and on over the days
and 2day it went from 28 register to 25 on its own
please help

LOL @ Paul, sorry man I probably shouldn't have messed with this. The default hack works as stated Thug but for the last 24 you will have to dig through this post.

Thug 02-07-2005 08:42 PM

why has it been changed

ericgtr 02-07-2005 08:45 PM

Someone requested it start at midinight instead of the last 24 hours (sorry I mis-stated this in my last post) and that's why there is code in a bunch of posts here. But, if you install the modification the way it is in the first post, it will give you the last 24.

Thug 02-07-2005 08:49 PM

so what codes do i need? please state it for my host to read and correct the errors

ericgtr 02-07-2005 09:11 PM

The code you need is in the very first post of this thread (or at the top of each page)

Thug 02-07-2005 09:14 PM

thanx

speedracer68 02-08-2005 01:21 AM

Very cool! Very easy install and it works!

Thanks!

Thug 02-08-2005 09:49 AM

i will show u the code.host says it same


All times are GMT. The time now is 06:35 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01243 seconds
  • Memory Usage 1,834KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (5)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete