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:
1 parent
bc26d62602
commit
f9b7997ec2
4 files changed
+74
-11
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user