fix(db): correct $wpdb->prepare usage in forum board and API audit

- Bind _aksrt_moderators with %s in get_user_managed_plates (stops 4× user-home notices)
- Guard API audit COUNT when no filter values (credits pattern)
This commit is contained in:
2026-07-15 16:04:49 +08:00
parent 1119d65c05
commit f6617c1f07
2 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -214,9 +214,10 @@ class AKSRT_API_Audit {
$where_sql = implode(' AND ', $where);
$offset = ($args['page'] - 1) * $args['per_page'];
$total = (int) $wpdb->get_var(
$wpdb->prepare("SELECT COUNT(*) FROM " . self::$table_name . " WHERE {$where_sql}", $values)
);
$count_sql = "SELECT COUNT(*) FROM " . self::$table_name . " WHERE {$where_sql}";
$total = (int) ($values
? $wpdb->get_var($wpdb->prepare($count_sql, $values))
: $wpdb->get_var($count_sql));
$values[] = $args['per_page'];
$values[] = $offset;