This block requires some custom block templates, so first download this hook, extract it, and import the CSBMemberBlockTemplates.xml file from ACP->Manage Hooks:
Then create a new Custom Sidebar Block with the following data:
Name: Today's Top Posters
Enabled : Yes
Hide From Main Custom Block: Depends on where you want it
Full Image Name: users.png (or whatever you wish as long as it is in the proper directory and use reference it)
Enable RAW HTML/JS mode: No
Enable PHP Mode: Yes
Use Table/Border/Title/Image?: Yes
Remove Ability for User to Collapse Block? Up to you
Content:
$html = "";
/* INIT */
$time_high = time();
$rows = array();
$time_low = $time_high - (60*60*24);
$todays_post = 0;
$store = array();
$mids = array();
$justSayNo = array();
$member_rows = "";
/* Re-moo-ve forums that do not allow incremental stuffywhasticmadoodah */
foreach( $this->registry->getClass('class_forums')->forum_by_id as $id => $data )
{
if ( ! $data['inc_postcount'] )
{
$justSayNo[] = $id;
}
}
$fiddyCent = $this->registry->getClass('class_forums')->fetchSearchableForumIds( $this->memberData['member_id'], $justSayNo );
$fiddyCent = ( count( $fiddyCent ) ) ? $fiddyCent : array( 0 => 0 );
/* Count posts today */
$total_today = $this->DB->buildAndFetch( array(
'select' => 'count(*) as cnt',
'from' => array( 'posts' => 'p' ),
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
'type' => 'left' ) ) ) );
/* Count member posts */
$this->DB->build( array('select' => 'COUNT(*) as tpost, p.author_id',
'from' => array( 'posts' => 'p' ),
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
'group' => 'p.author_id',
'order' => 'tpost DESC',
'limit' => array( 0, 10 ),
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
'type' => 'inner' ) ) ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$todays_posts += $r['tpost'];
$mids[ $r['author_id'] ] = $r['author_id'];
$store[] = $r;
}
if ( count( $mids ) )
{
$members = IPSMember::load( $mids );
}
/* Empty array for guests */
$members[0] = array();
if( $todays_posts )
{
foreach( $store as $info )
{
$info['total_today_posts'] = $todays_posts;
if ($todays_posts > 0 and $info['tpost'] > 0)
{
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $total_today['cnt'] ) * 100 );
}
$info = IPSMember::buildDisplayData( array_merge( $info, $members[ $info['author_id'] ] ) );
$extraData = $this->registry->getClass('class_localization')->formatNumber( $info['tpost'] )." - ".$info['today_pct']."%";
$member_rows .= $this->registry->output->getTemplate('boards')->customSidebarBlockMemRow($info, $extraData);
$rows[] = $info;
}
}
if ( $member_rows )
{
$html .= $this->registry->getClass('output')->getTemplate('boards')->customSidebarBlockMem( $member_rows );
}
return $html;











