Skip to content

Commit a0aa73e

Browse files
authored
Merge pull request #176 from WP-API/php52-compat
Remove closure from approved list
2 parents 9a2767e + 610fe99 commit a0aa73e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

admin.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ function rest_oauth1_profile_section( $user ) {
1818
global $wpdb;
1919

2020
$results = $wpdb->get_col( "SELECT option_value FROM {$wpdb->options} WHERE option_name LIKE 'oauth1_access_%'", 0 );
21-
$results = array_map( 'unserialize', $results );
22-
$approved = array_filter( $results, function ( $row ) use ( $user ) {
23-
return $row['user'] === $user->ID;
24-
} );
21+
$approved = array();
22+
foreach ( $results as $result ) {
23+
$row = unserialize( $result );
24+
if ( $row['user'] === $user->ID ) {
25+
$approved[] = $row;
26+
}
27+
}
2528

2629
$authenticator = new WP_REST_OAuth1();
2730

0 commit comments

Comments
 (0)