TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:29:01 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 174
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 170
  • Total: 170

New members Block

Started by akulion, October 09, 2006, 07:08:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

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

i would love to have this block - much credit to the one who creates the code  :coolsmiley:

JPDeni

#2
This is separate code, but you could put it wherever you wanted:

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.

akulion


akulion

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

:sigh:

Back to the drawing board, I guess. :)

akulion

dont worry atleast u got 88.543% of the code working (according to my calculations) :up:

JPDeni

Let's try it again. I left out a little minor detail.  ::)

Instead of
db_query("SELECT

use

$query = db_query("SELECT

That should do it. I'll edit the original code.

akulion

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

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