Astra_Admin_Ajax::astra_analytics_optin_status()
Astra Analytics Opt-in.
Description
Return
(void)
Source
File: admin/includes/class-astra-admin-ajax.php
	public function astra_analytics_optin_status() {
		$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
		if ( ! current_user_can( 'manage_options' ) ) {
			wp_send_json_error( $response_data );
		}
		if ( empty( $_POST ) ) {
			$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
			wp_send_json_error( $response_data );
		}
		/* Nonce verification */
		if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
			$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
			wp_send_json_error( $response_data );
		}
		$opt_in = filter_input( INPUT_POST, 'value', FILTER_VALIDATE_BOOL ) ? 'yes' : 'no';
		update_site_option( 'astra_analytics_optin', $opt_in );
		$response_data = array(
			'message' => esc_html__( 'Successfully saved data!', 'astra' ),
		);
		wp_send_json_success( $response_data );
	}
			Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description | 
|---|---|
| 4.10.0 | Introduced. |