What you posted is 'average posts per month' not posts count for the past 30 days.
Hook: member_execute_start
PHP Code:
$posts = $vbulletin->db->query_first( 'select count(*) as posts from post p where p.userid = ' . $userinfo['userid'] . ' and p.dateline >= UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL -30 DAY))' );
vB_Template::preRegister('memberinfo_block_statistics',array('postspermonth' => $posts['posts'])); // puts variable into template hook
Get fancier;
PHP Code:
$posts = $vbulletin->db->query_first( 'select sum(if( p.dateline >= UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 0 DAY)), 1, 0)) posts_0_day,sum(if( p.dateline >= UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL -1 DAY)), 1, 0)) posts_1_day,sum(if( p.dateline >= UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL -7 DAY)), 1, 0)) posts_7_day ,count(*) posts_30_day from post p where p.userid = ' . $userinfo['userid'] . ' and p.dateline >= UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL -30 DAY))');
$newvars = array(
'poststoday' => $posts['posts_0_day']
,'posts24hours' => $posts['posts_1_day']
,'poststhisweek' => $posts['posts_7_day']
,'postspermonth' => $posts['posts_30_day']
);
vB_Template::preRegister('memberinfo_block_statistics',$newvars); // puts variable into template hook