• Home
  • Knowledgebase
  • DevDocs
  • Translations
  • Support
  • Live Preview

logo DevDocs

By The Events Calendar
Filter by type:
Skip to content
Filter by type:
Search
Browse: Home / Classes / Abstract_Account_Api / Abstract_Account_Api::ajax_delete()
Product: Virtual Events

Abstract_Account_Api::ajax_delete( string|null $nonce = null )

Handles the request to delete a an API account.

Contents

  • Parameters
  • Return
  • Source
  • Changelog

Parameters

$nonce

(string|null) (Optional) The nonce that should accompany the request.

Default value: null


Top ↑

Return

(bool) Whether the request was handled or not.


Top ↑

Source

File: src/Tribe/Integrations/Abstract_Account_Api.php

	public function ajax_delete( $nonce = null ) {
		if ( ! $this->check_ajax_nonce( static::$delete_action, $nonce ) ) {
			return false;
		}

		$account_id = tribe_get_request_var( 'account_id' );
		$account    = $this->get_account_by_id( $account_id );
		// If no account id found, fail the request.
		if ( empty( $account_id ) || empty( $account ) ) {
			$error_message = sprintf(
				// translators: the placeholders is for the API name.
				_x(
					'The %1$s Account ID or Account is missing to change the status.',
					'Account ID is missing on status change error message.',
					'events-virtual'
				),
				static::$api_name
			);

			$this->get_settings_message_template( $error_message, 'error' );

			wp_die();
		}

		$success = $this->delete_account_by_id( $account_id );
		if ( $success ) {
			$message = sprintf(
				/* Translators: %1$s: the name of the account that has been deleted. */
				_x(
					'%1$s was successfully deleted',
					'Account ID is missing on status change error message.',
					'events-virtual'
				),
				static::$api_name
			);

			$this->get_settings_message_template( $message );

			wp_die();
		}

		$error_message = sprintf(
		/* Translators: %1$s: the name of the account that has been deleted. */
			_x(
				'The %1$s Account access token could not be revoked.',
				'Message to display when the %1$s account could not be loaded after being enabled.',
				'events-virtual'
			),
			static::$api_name
		);

		$this->get_settings_message_template( $error_message, 'error' );

		wp_die();
	}

Expand full source code Collapse full source code


Top ↑

Changelog

Changelog
Version Description
1.9.0 Introduced.
The Events Calendar
  • Home
  • Products
  • Blog
  • Support
© 2026 The Events Calendar Terms and Conditions Privacy