Skip to content

Commit 07019b2

Browse files
authored
Merge pull request #34 from WP-API/sync-application-status
Sync application status - always search published clients only
2 parents e159009 + f5e268a commit 07019b2

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

inc/class-client.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -314,33 +314,6 @@ public static function get_by_post_id( $id ) {
314314
return new static( $post );
315315
}
316316

317-
/**
318-
* Get a client by Client ID.
319-
*
320-
* @param int $id Client ID of the app.
321-
* @return static|null Client instance on success, null if invalid/not found.
322-
*/
323-
public static function get_by_client_id( $id ) {
324-
$args = array(
325-
'meta_query' => array(
326-
array(
327-
'key' => '_oauth2_client_id',
328-
'value' => $id,
329-
'compare' => '=',
330-
)
331-
),
332-
'post_type' => 'oauth2_client',
333-
'post_status' => 'any'
334-
);
335-
336-
$client_ids = get_posts( $args );
337-
if ( count( $client_ids ) !== 1 ) {
338-
return null;
339-
}
340-
341-
return new static( $client_ids[0] );
342-
}
343-
344317
/**
345318
* Create a new client.
346319
*

inc/types/class-base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function handle_authorisation() {
3939
$scope = isset( $_GET['scope'] ) ? wp_unslash( $_GET['scope'] ) : null;
4040
$state = isset( $_GET['state'] ) ? wp_unslash( $_GET['state'] ) : null;
4141

42-
$client = Client::get_by_client_id( $client_id );
42+
$client = Client::get_by_id( $client_id );
4343
if ( empty( $client ) ) {
4444
return new WP_Error(
4545
'oauth2.types.authorization_code.handle_authorisation.invalid_client_id',

0 commit comments

Comments
 (0)