Skip to content

Commit 4389816

Browse files
remove unrequired code
1 parent 7380c9b commit 4389816

1 file changed

Lines changed: 1 addition & 43 deletions

File tree

src/wp-includes/abilities/class-wp-users-abilities.php

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ private static function get_current_user_input_schema(): array {
8282
'description' => __( 'Whether to include the user capabilities in the response.' ),
8383
'default' => false,
8484
),
85-
'include_meta' => array(
86-
'type' => 'boolean',
87-
'description' => __( 'Whether to include user meta fields in the response.' ),
88-
'default' => false,
89-
),
9085
),
9186
'additionalProperties' => false,
9287
'default' => array(),
@@ -188,10 +183,6 @@ private static function get_current_user_output_schema(): array {
188183
'type' => 'object',
189184
'description' => __( 'All capabilities assigned to the user. Only included if include_capabilities is true.' ),
190185
),
191-
'meta' => array(
192-
'type' => 'object',
193-
'description' => __( 'User meta fields. Only included if include_meta is true.' ),
194-
),
195186
),
196187
'additionalProperties' => false,
197188
);
@@ -207,8 +198,7 @@ private static function get_current_user_output_schema(): array {
207198
*/
208199
public static function execute_get_current_user( array $input = array() ): array {
209200
$input = is_array( $input ) ? $input : array();
210-
$include_capabilities = ! empty( $input['include_capabilities'] ) && ( $input['include_capabilities'] === true || $input['include_capabilities'] === 'true' );
211-
$include_meta = ! empty( $input['include_meta'] ) && ( $input['include_meta'] === true || $input['include_meta'] === 'true' );
201+
$include_capabilities = ! empty( $input['include_capabilities'] );
212202

213203
$user = wp_get_current_user();
214204

@@ -234,38 +224,6 @@ public static function execute_get_current_user( array $input = array() ): array
234224
$result['capabilities'] = (object) $user->allcaps;
235225
}
236226

237-
if ( $include_meta ) {
238-
$result['meta'] = self::get_user_meta_for_response( $user->ID );
239-
}
240-
241227
return $result;
242228
}
243-
244-
/**
245-
* Gets user meta fields for the response.
246-
*
247-
* @since 6.9.0
248-
*
249-
* @param int $user_id The user ID.
250-
* @return array<string, mixed> The user meta.
251-
*/
252-
private static function get_user_meta_for_response( int $user_id ): array {
253-
$meta = get_user_meta( $user_id );
254-
$processed_meta = array();
255-
256-
foreach ( $meta as $key => $values ) {
257-
// Skip private meta keys (prefixed with underscore).
258-
if ( str_starts_with( $key, '_' ) ) {
259-
continue;
260-
}
261-
262-
if ( count( $values ) === 1 ) {
263-
$processed_meta[ $key ] = maybe_unserialize( $values[0] );
264-
} else {
265-
$processed_meta[ $key ] = array_map( 'maybe_unserialize', $values );
266-
}
267-
}
268-
269-
return $processed_meta;
270-
}
271229
}

0 commit comments

Comments
 (0)