Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
Filter out posts from private / spam blogs
· 8ef06e35
ale
authored
Aug 21, 2023
Filter them out at display time so that removing a blog will result in its posts no longer showing.
8ef06e35
Hide whitespace changes
Inline
Side-by-side
ai-global-activity.php
View file @
8ef06e35
...
...
@@ -3,7 +3,7 @@
* Plugin Name: ai-global-activity
* Plugin URI: https://git.autistici.org/noblogs/ai-global-activity-plugin
* Description: Update global activity feed
* Version: 0.0.2
3
* Version: 0.0.2
4
* Author: Autistici/Inventati
* Author URI: https://www.autistici.org/
* License: MIT
...
...
@@ -154,8 +154,14 @@ function ai_activity_get_latest_posts($offset, $limit) {
$table_name
=
AI_ACTIVITY_TABLE_NAME
;
$results
=
$wpdb
->
get_results
(
$wpdb
->
prepare
(
"
SELECT blog_id, post_id, title, author, excerpt, url, thumbnail_url, published_at
FROM
{
$table_name
}
SELECT
a.blog_id AS blog_id, a.post_id AS post_id, a.title AS title, a.author AS author,
a.excerpt AS excerpt, a.url AS url, a.thumbnail_url AS thumbnail_url, a.published_at AS published_at
FROM
{
$table_name
}
AS a
JOIN wp_blogs AS b
ON a.blog_id = b.blog_id
WHERE
b.public = 1 AND b.spam = 0 AND b.deleted = 0 AND b.mature = 0
ORDER BY published_at DESC
LIMIT %d OFFSET %d
"
,
...
...