[req] Statistics: posts per day

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
JPV
Registered User
Posts: 58
Joined: Wed Sep 25, 2002 9:29 am

[req] Statistics: posts per day

Post by JPV »

i'd like to have a mod that shows me the number of posts day per day.

that doesn't need to be in the index.php, something like a part in the statistics.php from that other mod would already be nice (though you can do it in another page if necessary).

or can anyone just give me the codes that would make me able to do this by my own (i can check out the month by month statistics code, and adapt it, but i don't know how to count day per day)?

tnx a lot...

JPV
talia679
Registered User
Posts: 716
Joined: Tue Mar 12, 2002 4:07 pm
Location: PA
Contact:

Post by talia679 »

Thanks, Talia
Tag You're It Writing Community || TYI Forums
Taleria - Talia's Gallery of 2000+ Links & 140+ Books
GameCrafters Guild – Gaming info and resources
JPV
Registered User
Posts: 58
Joined: Wed Sep 25, 2002 9:29 am

Post by JPV »

talia679 wrote: List of all modules for Stats mod:

http://www.phpbbhacks.com/category.php?id=24&version=2

i know, but there ain't anything that calculates posts per day...

this is the nearest i can find, but i don't know how to adapt this to calculate the number of posts in a day...

Code: Select all

$sql = 'SELECT YEAR(FROM_UNIXTIME(post_time)) as aar, MONTH(FROM_UNIXTIME(post_time)) as mnd, COUNT(*) AS ant
FROM ' . POSTS_TABLE . ' 
GROUP BY YEAR(FROM_UNIXTIME(post_time)),MONTH(FROM_UNIXTIME(post_time)) 
ORDER BY post_time';
	
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Couldn\'t retrieve posts data', '', __LINE__, __FILE__, $sql);
}

$posts_count = $db->sql_numrows($result);
$posts_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < $posts_count; $i=$i+$k)
{
	$class = ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'];
		
	$year = $posts_data[$i]['aar'];
	$k = 0;
	for ($j = 0; $j < 12; $j++)
	{
		$m[$j+1] = 0;
	}
	for ($j = 0; $j < 12; $j++)
	{
		if ($year == $posts_data[$i+$j]['aar'])
		{
			$month = $posts_data[$i+$j]['mnd'];
			$m[$month] = $posts_data[$i+$j]['ant'];
			$k = $k + 1;
		}
	}
	$template->assign_block_vars('newposts', array(
		'CLASS' => $class,
		'YEAR' => $year,			
		'M01' => $m[1],
		'M02' => $m[2],
		'M03' => $m[3],
		'M04' => $m[4],
		'M05' => $m[5],
		'M06' => $m[6],
		'M07' => $m[7],
		'M08' => $m[8],
		'M09' => $m[9],
		'M10' => $m[10],
		'M11' => $m[11],
		'M12' => $m[12])
	);
}

$template->assign_vars(array(
	'L_NEWPOSTSBYMONTH' => $lang['Posts_month'],
	'L_YEAR' => $lang['Year'],
	'L_MONTH' => $lang['Month'],
	'L_NUMBER' => $lang['Number'],
	'L_JAN' => $lang['Month_jan'],
	'L_FEB' => $lang['Month_feb'],
	'L_MAR' => $lang['Month_mar'],
	'L_APR' => $lang['Month_apr'],
	'L_MAY' => $lang['Month_may'],
	'L_JUN' => $lang['Month_jun'],
	'L_JUL' => $lang['Month_jul'],
	'L_AUG' => $lang['Month_aug'],
	'L_SEP' => $lang['Month_sep'],
	'L_OCT' => $lang['Month_oct'],
	'L_NOV' => $lang['Month_nov'],
	'L_DEC' => $lang['Month_dec'])
);
daruler
Registered User
Posts: 62
Joined: Thu Apr 22, 2004 2:30 pm

Post by daruler »

Hi,

just Install the Word Count Mod (http://www.phpbb.com/phpBB/viewtopic.php?t=218470) an then you can use this module to show the average of posts in the statistics: http://www.fftrealm.com/top_user_word_count.pak
Post Reply

Return to “[2.0.x] MOD Requests”