bbp_update_forum_topic_count_hidden (intforum_id美元,inttopic_count美元)
调整论坛隐藏主题总数(隐藏包括垃圾和垃圾主题)
描述
参数
- forum_id美元
-
(int)(可选)要更新的主题id
- topic_count美元
-
(int)(可选)手动设置主题计数
返回
(int)主题隐藏主题计数
源
函数bbp_update_forum_topic_count_hidden($forum_id = 0, $topic_count = 0) {global $wpdb;//如果topic_id作为$forum_id传递,则获取其论坛If (bbp_is_topic($forum_id)) {$topic_id = bbp_get_topic_id($forum_id);$forum_id = bbp_get_topic_forum_id($topic_id);} else {$forum_id = bbp_get_forum_id($forum_id);} //不能更新不存在的内容if (!empty($forum_id)){//获取论坛的主题if (empty($topic_count)) {$post_status = "'"。Implode ("','", array(bbp_get_trash_status_id(), bbp_get_spam_status_id()))。“的”;$topic_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ({$post_status}) AND post_type = '%s';", $forum_id, bbp_get_topic_post_type()));} //更新计数update_post_meta($forum_id, '_bbp_topic_count_hidden', (int) $topic_count);} return (int) apply_filters('bbp_update_forum_topic_count_hidden', (int) $topic_count, $forum_id); }
更新日志
版本 | 描述 |
---|---|
bbPress (r2888) | 介绍了。 |