Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 04:22:59 AM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 51
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 37
Total: 38

Author Topic: New members Block  (Read 29020 times)

0 Members and 1 Guest are viewing this topic.

akulion

  • Guest
New members Block
« on: October 09, 2006, 12:08:23 PM »
Hi

I've seen this on a few joomla based sites where you get something like:

Total Members 233234
New This Month:123
New This Week: 45
New Today: 8

Can someone make something similar for inclusion with the stats box?

Aku

knat

  • Guest
Re: New members Block
« Reply #1 on: October 09, 2006, 12:16:01 PM »
i would love to have this block - much credit to the one who creates the code  :coolsmiley:

JPDeni

  • Guest
Re: New members Block
« Reply #2 on: October 09, 2006, 02:58:37 PM »
This is separate code, but you could put it wherever you wanted:

Code: [Select]
global $db_prefix,$modSettings;

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Total Members: ', $modSettings['totalMembers'],'<br />';
echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];

It also returns the number for the year. I figured I'd go ahead and get the data just in case someone might want it.
« Last Edit: February 26, 2007, 07:18:57 AM by JPDeni »

akulion

  • Guest
Re: New members Block
« Reply #3 on: October 09, 2006, 03:02:21 PM »
Thanks

ill try it out asap :D

akulion

  • Guest
Re: New members Block
« Reply #4 on: October 09, 2006, 03:06:43 PM »
no workie

gving stats:

Total Members: 1039
New This Month: 0
New This Week: 0
New Today: 0

and today 3 people joined up and this week according to my approximation about 5 to 7 people joined up

and for the moth the stats show:  19 people joined

but it shows zero for all

JPDeni

  • Guest
Re: New members Block
« Reply #5 on: October 09, 2006, 03:10:31 PM »
:sigh:

Back to the drawing board, I guess. :)

akulion

  • Guest
Re: New members Block
« Reply #6 on: October 09, 2006, 03:12:23 PM »
dont worry atleast u got 88.543% of the code working (according to my calculations) :up:

JPDeni

  • Guest
Re: New members Block
« Reply #7 on: October 09, 2006, 03:14:03 PM »
Let's try it again. I left out a little minor detail.  ::)

Instead of
Code: [Select]
db_query("SELECT
use

Code: [Select]
$query = db_query("SELECT
That should do it. I'll edit the original code.

akulion

  • Guest
Re: New members Block
« Reply #8 on: October 09, 2006, 03:18:54 PM »
now it is working 98.945%

the reason i say this is cos today someone joined my forum in front of me (about 2 hours back) and made a lotta posts and requested dance songs on the online radio as well lol

but it shows:
Total Members: 1039
New This Month: 18
New This Week: 7
New Today: 0

JPDeni

  • Guest
Re: New members Block
« Reply #9 on: October 09, 2006, 03:22:54 PM »
What time is it where you are? Or, better still, what time is it where your server is? The day is the calendar day as defined by your server. So, if it's after midnight wherever your server is, you won't get anybody who registered before midnight. We could change it to "within the last 24 hours."