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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user