fix(user): match profile validation hook argument type

Accept the stdClass user data passed by WordPress and derive the user ID only from the hook object. Cover callback registration, nonce and permission guards, and mismatched posted IDs; refresh the identity review dialog contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-30 20:38:00 +08:00
1 parent bc26d62602
commit f9b7997ec2
4 files changed
+74 -11

No files matched your search

+2 -2
View File
@@ -85,8 +85,8 @@ final class ProfileAdmin {
<?php
}
public static function validate(\WP_Error $errors, bool $update, ?\WP_User $user = null): void {
$user_id = $user instanceof \WP_User ? (int) $user->ID : (int) ($_POST['user_id'] ?? 0);
public static function validate(\WP_Error $errors, bool $update, \stdClass $user): void {
$user_id = (int) ($user->ID ?? 0);
if ($user_id <= 0 || !current_user_can('edit_user', $user_id) || empty($_POST[self::PROFILE_NONCE])) {
return;
}