May 20, 2018 9:37 am
This is a specific case. wpForo doesn't display last post info stat if that info comes from a forum which is private for regular visitors (guests). To make it available for registered users you should put this code in WordPress theme functions.php file.
function wpforo_fix_footer_stat_for_private_forum( $stats ) {
if(function_exists('WPF')){
$posts = WPF()->topic->get_topics(array('orderby' => 'modified', 'order' => 'DESC', 'row_count' => 1, 'private' => 0, 'status' => 0 ));
$key = key($posts);
if ( wpfval($posts, $key) ) {
$stats['last_post_title'] = $posts[$key]['title'];
$stats['last_post_url'] = WPF()->post->get_post_url($posts[$key]['last_post']);
}
}
return $stats;
}
add_filter( 'wpforo_get_statistic_array_filter', 'wpforo_fix_footer_stat_for_private_forum');
How to Easily Add Custom Code in WordPress (without Breaking Your Site)
IMPORTANT: Once you put this code, please navigate to Dashboard > Forum Dashboard admin page and click on [Delete all caches] and [Update Forum Statistic] buttons.
May 25, 2018 1:13 pm
This worked, thanks.
Page 3 / 3
Prev