* fixed CVE-2024-12276;

* reviewed using $wpdb and WPCS;
* set minimum required version to 6.2 due to using %i for $wpdb->prepare;
This commit is contained in:
Mykyta Synelnikov
2025-02-03 16:17:37 +02:00
parent 26c8aa21e1
commit 4adbe19cbe
19 changed files with 249 additions and 194 deletions
+9 -1
View File
@@ -211,7 +211,15 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
return 0;
}
$count = $wpdb->get_var("SELECT COUNT(comment_ID) FROM " . $wpdb->comments. " WHERE user_id = " . $user_id . " AND comment_approved = '1'");
$count = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(comment_ID)
FROM {$wpdb->comments}
WHERE user_id = %d AND
comment_approved = '1'",
$user_id
)
);
return $this->pretty_number_formatting( $count );
}