*/ __( 'After that they can be reassigned to the logged-in user by going to the WooCommerce webhooks settings page and re-saving them.', 'woocommerce' ), $webhooks_settings_url ); echo '

' . wp_kses_post( $text ) . '

'; } /** * Get the ids of the webhooks assigned to a given user. * * @param int $user_id User id. * @return int[] Array of webhook ids. */ private function get_webhook_ids_for_user( int $user_id ): array { $data_store = \WC_Data_Store::load( 'webhook' ); return $data_store->search_webhooks( array( 'user_id' => $user_id, ) ); } /** * Gets the count of webhooks that are configured to use the Legacy REST API to compose their payloads. * * @param bool $clear_cache If true, the previously cached value of the count will be discarded if it exists. * * @return int */ public function get_legacy_webhooks_count( bool $clear_cache = false ): int { global $wpdb; $cache_key = WC_Cache_Helper::get_cache_prefix( 'webhooks' ) . 'legacy_count'; if ( $clear_cache ) { wp_cache_delete( $cache_key, 'webhooks' ); } $count = wp_cache_get( $cache_key, 'webhooks' ); if ( false === $count ) { $count = absint( $wpdb->get_var( "SELECT count( webhook_id ) FROM {$wpdb->prefix}wc_webhooks WHERE `api_version` < 1;" ) ); wp_cache_add( $cache_key, $count, 'webhooks' ); } return $count; } }