fix(user): accept core avatar hook payload
This commit is contained in:
@@ -182,7 +182,7 @@ if (!function_exists('aksrt_render_admin_avatar_field')) {
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('user_profile_update_errors', static function (WP_Error $errors, bool $update, WP_User $user): void {
|
||||
add_filter('user_profile_update_errors', static function (WP_Error $errors, bool $update): void {
|
||||
if (empty($_FILES['aksrt_avatar_file']['name']) || !aksrt_is_avatar_upload_enabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ add_filter('user_profile_update_errors', static function (WP_Error $errors, bool
|
||||
if (empty($checked['type']) || empty($checked['ext']) || !wp_match_mime_types('image', $checked['type']) || !$image_size || ((int) $image_size[0] * (int) $image_size[1]) > 40000000) {
|
||||
$errors->add('aksrt_avatar_type', __('头像必须是有效的 JPG、PNG、GIF 或 WebP 图片,且总像素不能超过 4000 万。', 'aksrt'));
|
||||
}
|
||||
}, 10, 3);
|
||||
}, 10, 2);
|
||||
|
||||
add_action('personal_options_update', 'aksrt_save_admin_avatar_field');
|
||||
add_action('edit_user_profile_update', 'aksrt_save_admin_avatar_field');
|
||||
|
||||
Reference in New Issue
Block a user