From bfca991d272fa71d53ac8670a03ccdce94a1a213 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 11 Nov 2025 19:18:38 +0800 Subject: [PATCH] Remove `convertkit_store_subscriber_id_in_cookie` AJAX action The JS for this AJAX action was removed in 2.6.7, released 4th December 2024. No logic in the Plugin calls this method or its action. --- includes/class-convertkit-ajax.php | 46 ------------------------------ 1 file changed, 46 deletions(-) diff --git a/includes/class-convertkit-ajax.php b/includes/class-convertkit-ajax.php index b277b0d12..ed5d17e13 100644 --- a/includes/class-convertkit-ajax.php +++ b/includes/class-convertkit-ajax.php @@ -22,9 +22,6 @@ public function __construct() { add_action( 'wp_ajax_convertkit_get_blocks', array( $this, 'get_blocks' ) ); - add_action( 'wp_ajax_nopriv_convertkit_store_subscriber_id_in_cookie', array( $this, 'store_subscriber_id_in_cookie' ) ); - add_action( 'wp_ajax_convertkit_store_subscriber_id_in_cookie', array( $this, 'store_subscriber_id_in_cookie' ) ); - add_action( 'wp_ajax_nopriv_convertkit_store_subscriber_email_as_id_in_cookie', array( $this, 'store_subscriber_email_as_id_in_cookie' ) ); add_action( 'wp_ajax_convertkit_store_subscriber_email_as_id_in_cookie', array( $this, 'store_subscriber_email_as_id_in_cookie' ) ); @@ -65,49 +62,6 @@ public function get_blocks() { } - /** - * Stores the ConvertKit Subscriber's ID in a cookie. - * - * Typically performed when the user subscribes via a ConvertKit Form on the web site - * that is set to "Send subscriber to thank you page", and the Plugin's JavaScript is not - * disabled, permitting convertkit.js to run. - * - * @since 1.9.6 - */ - public function store_subscriber_id_in_cookie() { - - // Check nonce. - check_ajax_referer( 'convertkit', 'convertkit_nonce' ); - - // Bail if required request parameters not submitted. - if ( ! isset( $_REQUEST['subscriber_id'] ) ) { - wp_send_json_error( __( 'Kit: Required parameter `subscriber_id` not included in AJAX request.', 'convertkit' ) ); - } - - // Bail if no subscriber ID provided. - $id = absint( sanitize_text_field( wp_unslash( $_REQUEST['subscriber_id'] ) ) ); - if ( empty( $id ) ) { - wp_send_json_error( __( 'Kit: Required parameter `subscriber_id` empty in AJAX request.', 'convertkit' ) ); - } - - // Get subscriber ID. - $subscriber = new ConvertKit_Subscriber(); - $subscriber_id = $subscriber->validate_and_store_subscriber_id( $id ); - - // Bail if an error occured i.e. API hasn't been configured, subscriber ID does not exist in ConvertKit etc. - if ( is_wp_error( $subscriber_id ) ) { - wp_send_json_error( $subscriber_id->get_error_message() ); - } - - // Return the subscriber ID. - wp_send_json_success( - array( - 'id' => $subscriber_id, - ) - ); - - } - /** * Stores the ConvertKit Subscriber Email's ID in a cookie. *