diff --git a/functions.php b/functions.php index 4154c7b..db234af 100644 --- a/functions.php +++ b/functions.php @@ -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); } }