From 75e9d5e4a8c5ec20f438e7b24a5469d219959a8c Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 3 May 2025 16:24:48 +0300 Subject: [PATCH] feat(atom): Hide topics from private forums (#1889) --- src/Legacy/Atom.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Legacy/Atom.php b/src/Legacy/Atom.php index 21d65d7ac..10b78422e 100644 --- a/src/Legacy/Atom.php +++ b/src/Legacy/Atom.php @@ -25,10 +25,17 @@ class Atom */ public static function update_forum_feed($forum_id, $forum_data) { - global $bb_cfg, $lang; + global $bb_cfg, $lang, $datastore; $sql = null; $file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom'; $select_tor_sql = $join_tor_sql = ''; + + if (!$forums = $datastore->get('cat_forums')) { + $datastore->update('cat_forums'); + $forums = $datastore->get('cat_forums'); + } + $not_forums_id = $forums['not_auth_forums']['guest_view']; + if ($forum_id == 0) { $forum_data['forum_name'] = $lang['ATOM_GLOBAL_FEED'] ?? $bb_cfg['server_name']; } @@ -77,6 +84,9 @@ class Atom $topics_tmp = DB()->fetch_rowset($sql); $topics = []; foreach ($topics_tmp as $topic) { + if (in_array($topic['topic_id'], explode(',', $not_forums_id))) { + continue; + } if (isset($topic['topic_status'])) { if ($topic['topic_status'] == TOPIC_MOVED) { continue;