fixed bug to count topics.
This commit is contained in:
parent
6c26b056dd
commit
7d256444b3
@ -12,7 +12,6 @@ function cbsonline_exclude_plugins_from_auto_update($update, $item)
|
||||
return !in_array($item->slug, ['bogo']);
|
||||
}
|
||||
|
||||
|
||||
// remove parent theme defined filters and actions
|
||||
add_action('after_setup_theme', 'cbsonline_disable_parent_defines');
|
||||
function cbsonline_disable_parent_defines()
|
||||
@ -442,6 +441,12 @@ function cbsonline_wpforo_topic_get_topics($args = [], &$items_count = 0, $count
|
||||
if ($count) {
|
||||
$item_count_sql = preg_replace('#SELECT.+?FROM#isu', 'SELECT count(*) FROM', $sql);
|
||||
if ($item_count_sql) {
|
||||
if (!is_null($join)) {
|
||||
$keys = ['topics', 'forumid', 'first_postid', 'userid', 'title', 'slug', 'created', 'modified', 'last_post', 'posts', 'votes', 'answers', 'views', 'meta_key', 'meta_desc', 'type', 'solved', 'closed', 'has_attach', 'private', 'status', 'name', 'email', 'prefix', 'tags'];
|
||||
foreach ($keys as $key) {
|
||||
$item_count_sql = str_replace(' `'.$key.'`', ' `'.WPF()->tables->topics.'`.`'.$key.'`', $item_count_sql);
|
||||
}
|
||||
}
|
||||
$items_count = WPF()->db->get_var($item_count_sql);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user