Hello. I was wondering if any of this code is out of date or incorretly phrased, or simply wrong.
Because, for some reason, on my forums. The subscribed members total won't refresh. It only refreshes if I delete a member first.
function show_totals()
{
global $DB, $ibforums, $std;
if ($ibforums->vars['show_totals'])
{
if ( ! is_array( $ibforums->cache['stats'] ) )
{
$ibforums->cache['stats'] = array();
$DB->simple_exec_query( array( 'delete' => 'cache_store', 'where' => "cs_key='stats'" ) );
$DB->do_insert( 'cache_store', array( 'cs_array' => 1, 'cs_key' => 'stats', 'cs_value' => addslashes(serialize($ibforums->cache['stats'])) ) );
}
$stats = $ibforums->cache['stats'];
//----------------------------------------
// Update the most active count if needed
//----------------------------------------
if ($this->users_online > $stats['most_count'])
{
$stats['most_count'] = $this->users_online;
$stats['most_date'] = time();
$DB->do_update( 'cache_store',
array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($stats)) ),
"cs_key='stats'"
);
}
$most_time = $std->get_date( $stats['most_date'], 'LONG' );
$ibforums->lang['most_online'] = str_replace( "<#NUM#>" , $std->do_number_format($stats['most_count']) , $ibforums->lang['most_online'] );
$ibforums->lang['most_online'] = str_replace( "<#DATE#>", $most_time , $ibforums->lang['most_online'] );
$total_posts = $stats['total_replies'] + $stats['total_topics'];
$total_posts = $std->do_number_format($total_posts);
$stats['mem_count'] = $std->do_number_format($stats['mem_count']);
$this->total_posts = $total_posts;
$this->total_members = $stats['mem_count'];
$link = $ibforums->base_url."showuser=".$stats['last_mem_id'];
$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts" , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#reg#>" , $stats['mem_count'] , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#mem#>" , $stats['last_mem_name'] , $ibforums->lang['total_word_string'] );
$ibforums->lang['total_word_string'] = str_replace( "<#link#>" , $link , $ibforums->lang['total_word_string'] );
$stats_html .= $this->class->html->ShowStats($ibforums->lang['total_word_string']);
}
return $stats_html;
}
}
Thanks.