PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.1
Forumax – AI Powered Advanced Community Forum Plugin v2.5.1
2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 All 31 releases
← All changes | widgets/Forumax_Active_Members.php +8 -3 2.4.3 → 2.5.1 View file →
@@ -131,19 +131,24 @@
131 131 */
132 132 private function get_topic_participants( $topic_id, $max_shown ) {
133 133 global $wpdb;
134 134
135 + // GROUP BY + MAX() instead of DISTINCT ... ORDER BY post_date, which
136 + // MySQL 5.7+/8 rejects (ORDER BY column not in the SELECT list).
135 137 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
136 138 $results = $wpdb->get_col(
137 139 $wpdb->prepare(
138 - "SELECT DISTINCT post_author
140 + "SELECT post_author
139 141 FROM {$wpdb->posts}
140 142 WHERE post_parent = %d
141 143 AND post_type = %s
142 144 AND post_status IN ( 'publish', 'closed' )
143 - ORDER BY post_date DESC",
145 + GROUP BY post_author
146 + ORDER BY MAX( post_date ) DESC
147 + LIMIT %d",
144 148 $topic_id,
145 - bbp_get_reply_post_type()
149 + bbp_get_reply_post_type(),
150 + $max_shown > 0 ? $max_shown + 1 : 1000
146 151 )
147 152 );
148 153
149 154 // Include the topic author at the beginning.