Abstract_API_Key_Api::load_api_key_by_id( string $consumer_id, string $consumer_secret )
Load a specific api_key by the id.
Contents
Parameters
- $consumer_id
-
(string) (Required) The consumer id to get and load an API Key pair.
- $consumer_secret
-
(string) (Required) The consumer secret used to verify an API Key pair.
Return
(bool|WP_Error) Whether the page is loaded or a WP_Error code.
Source
File: src/Common/Event_Automator/Zapier/Abstract_API_Key_Api.php
public function load_api_key_by_id( $consumer_id, $consumer_secret ) {
$consumer_id = strpos( $consumer_id, 'ci_' ) === 0
? static::api_hash( $consumer_id )
: $consumer_id;
$api_key = $this->get_api_key_by_id( $consumer_id );
// Return false if no api_key.
if ( empty( $api_key ) ) {
$error_msg = _x( 'Consumer ID failed to load, please check the value and try again.', 'Zapier API failure message.', 'event-automator' );
return new WP_Error( 'zapier_consumer_id_not_found', $error_msg, [ 'status' => 400 ] );
}
return $this->load_api_key( $api_key, $consumer_secret );
}
Changelog
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |