From 081d16d907a092c493639ce6e39ef908768b0245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dark=E2=9D=B6?= Date: Thu, 27 Feb 2020 21:14:30 +0530 Subject: [PATCH 1/2] [ticket/16381] Add core event to Modify Topics SQL PHPBB3-16381 --- phpBB/viewforum.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 4691512cbd..8394fa27fb 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -710,10 +710,28 @@ if (count($topic_list)) 'SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], - 'WHERE' => $db->sql_in_set('t.topic_id', $topic_list), ); + /** + * Event to modify the SQL query before obtaining topics/stickies + * + * @event core.viewforum_modify_topics_sql + * @var int forum_id The forum ID + * @var array forum_data Data about the forum + * @var array topic_list Topic ids array + * @var array sql_array SQL query array for obtaining topics/stickies + * + * @since 3.2.10-RC1 + */ + $vars = array( + 'forum_id', + 'forum_data', + 'topic_list', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_sql', compact($vars))); + // If store_reverse, then first obtain topics, then stickies, else the other way around... // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because // the number of stickies are not known From 6f0f3667802593a05b55e3252e6c4711d6bc9ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dark=E2=9D=B6?= Date: Fri, 28 Feb 2020 00:14:47 +0530 Subject: [PATCH 2/2] [ticket/16381] Add core event to Modify Topics SQL PHPBB3-16381 --- phpBB/viewforum.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 8394fa27fb..f8793bdf2e 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -716,7 +716,7 @@ if (count($topic_list)) /** * Event to modify the SQL query before obtaining topics/stickies * - * @event core.viewforum_modify_topics_sql + * @event core.viewforum_modify_topic_list_sql * @var int forum_id The forum ID * @var array forum_data Data about the forum * @var array topic_list Topic ids array @@ -724,13 +724,13 @@ if (count($topic_list)) * * @since 3.2.10-RC1 */ - $vars = array( + $vars = [ 'forum_id', 'forum_data', 'topic_list', 'sql_array', - ); - extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_sql', compact($vars))); + ]; + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_list_sql', compact($vars))); // If store_reverse, then first obtain topics, then stickies, else the other way around... // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because