• 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::load_account()
Product: Virtual Events

Abstract_Account_Api::load_account( TribeEventsVirtualIntegrationsarray $account = array() )

Load a specific account into the API.

Contents

  • Parameters
  • Return
  • Source
  • Changelog

Parameters

$account

(<span class="TribeEventsVirtualIntegrationsarrayTribeEventsVirtualIntegrationsarray<string|">TribeEventsVirtualIntegrationsstring>) (Optional) An account with the fields to access the API.

Default value: array()


Top ↑

Return

(boolean) Whether the account is loaded into the class to use for the API, default is false.


Top ↑

Source

File: src/Tribe/Integrations/Abstract_Account_Api.php

	public function load_account( array $account = [] ) {
		if ( $this->is_valid_account( $account ) ) {
			$this->init_account( $account );

			return true;
		}

		// Check for single events first.
		$loaded_account = '';
		if ( is_singular( TEC::POSTTYPE ) ){
			$post_id = get_the_ID();

			// Get the account id and if found, use to get the account.
			if ( $account_id = get_post_meta( $post_id, $this->account_id_meta_field_name, true ) ) {
				$loaded_account = $this->get_account_by_id( $account_id );
			}

			if ( ! $loaded_account ) {
				return false;
			}

			if ( $this->is_valid_account( $loaded_account ) ) {
				$this->init_account( $loaded_account );

				return true;
			}
		}

		// If nothing loaded so far and this is not the admin, then return false.
		if ( ! is_admin() ) {
			return false;
		}

		$account_id = $this->get_account_id_in_admin();

		// Get the account id and if found, use to get the account.
		if ( $account_id ) {
			$loaded_account = $this->get_account_by_id( $account_id );
		}

		if ( ! $loaded_account ) {
			return false;
		}

		if ( $this->is_valid_account( $loaded_account ) ) {
			$this->init_account( $loaded_account );

			return true;
		}

		return false;
	}

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