Skip to content

Commit c32f06a

Browse files
authored
Update wp_bbp_forums.sql
1 parent c8acd35 commit c32f06a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

generate/updates/wp_bbp_forums.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,21 @@ UPDATE wp_bbp_forums f INNER JOIN (
2323
INNER JOIN wp_posts p ON p.ID = t.reply_id AND p.post_status IN ('publish')
2424
GROUP BY t.forum_id) r ON r.forum_id = f.forum_id
2525
SET f.last_reply_id = r.reply_id, f.reply_count = r.reply_count;
26+
27+
/* Update topic_count_hidden */
28+
UPDATE wp_bbp_forums f INNER JOIN (
29+
SELECT t.forum_id, COUNT(t.topic_id) AS topic_count_hidden
30+
FROM wp_bbp_topics t
31+
INNER JOIN wp_bbp_forums f ON f.forum_id = t.forum_id AND f.forum_type = 'forum'
32+
INNER JOIN wp_posts p ON p.ID = t.topic_id AND p.post_status IN ('pending', 'trash', 'spam')
33+
GROUP BY t.forum_id) t ON t.forum_id = f.forum_id
34+
SET f.topic_count_hidden = t.topic_count_hidden;
35+
36+
/* Update reply_count_hidden */
37+
UPDATE wp_bbp_forums f INNER JOIN (
38+
SELECT t.forum_id, COUNT(t.reply_id) AS reply_count_hidden
39+
FROM wp_bbp_replies t
40+
INNER JOIN wp_bbp_forums f ON f.forum_id = t.forum_id AND f.forum_type = 'forum'
41+
INNER JOIN wp_posts p ON p.ID = t.reply_id AND p.post_status IN ('pending', 'trash', 'spam')
42+
GROUP BY t.forum_id) r ON r.forum_id = f.forum_id
43+
SET f.reply_count_hidden = r.reply_count_hidden;

0 commit comments

Comments
 (0)