WC_API_Authentication::get_keys_by_consumer_key()
Return the keys for the given consumer key
Метод класса: WC_API_Authentication{}
Хуков нет.
Возвращает
Массив
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_keys_by_consumer_key( $consumer_key );
- $consumer_key(строка) (обязательный)
- -
Список изменений
С версии 2.4.0 | Введена. |
Код WC_API_Authentication::get_keys_by_consumer_key() WC API Authentication::get keys by consumer key WC 8.1.1
private function get_keys_by_consumer_key( $consumer_key ) { global $wpdb; $consumer_key = wc_api_hash( sanitize_text_field( $consumer_key ) ); $keys = $wpdb->get_row( $wpdb->prepare( " SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces FROM {$wpdb->prefix}woocommerce_api_keys WHERE consumer_key = '%s' ", $consumer_key ), ARRAY_A ); if ( empty( $keys ) ) { throw new Exception( __( 'Consumer key is invalid.', 'woocommerce' ), 401 ); } return $keys; }