Tribe__Events__Community__Tickets__Main::plugins_loaded()
Bootstrap the plugin with the plugins_loaded action
Source
File: src/Tribe/Main.php
public function plugins_loaded() {
add_action( 'init', array( $this, 'init' ), 5 );
add_filter( 'user_has_cap', array( $this, 'user_has_edit_event_tickets_cap' ), 1, 3 );
add_filter( 'user_has_cap', array( $this, 'user_has_sell_event_tickets_cap' ), 2, 3 );
add_filter( 'user_has_cap', array( $this, 'user_has_edit_tribe_events_cap' ), 2, 3 );
// This allows event owners to fetch/read orders on posts they own
add_filter( 'user_has_cap', array( $this, 'user_has_read_private_shop_orders' ), 10, 3 );
$mopath = $this->plugin_dir . 'lang/';
$domain = 'tribe-events-community-tickets';
// If we don't have Common classes load the old fashioned way
if ( ! class_exists( 'Tribe__Main' ) ) {
load_plugin_textdomain( $domain, false, $mopath );
} else {
// This will load `wp-content/languages/plugins` files first
Tribe__Main::instance()->load_text_domain( $domain, $mopath );
}
if ( ! $this->should_run() ) {
// Display notice indicating which plugins are required
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
return;
}
$this->pue = new Tribe__Events__Community__Tickets__PUE( "{$this->plugin_path}/events-community-tickets.php" );
require_once $this->plugin_path . 'src/functions/template-tags.php';
if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
add_action( 'wp_enqueue_scripts', array( $this, 'register_resources' ) );
$this->event_form();
$this->payment_options_form();
$this->templates();
add_filter( 'user_has_cap', array( $this, 'give_subscribers_upload_files_cap' ), 10, 3 );
}
add_action( 'admin_enqueue_scripts', array( $this, 'register_resources' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'maybe_enqueue_admin_resources' ), 11 );
add_action( 'tribe_community_events_enqueue_resources', array( $this, 'maybe_enqueue_frontend' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_frontend' ) );
add_filter( 'tribe_events_template_paths', array( $this, 'add_template_paths' ) );
add_action( 'wp_router_generate_routes', array( $this, 'generate_routes' ) );
add_action( 'tribe_ce_event_list_table_row_actions', array( $this, 'report_links' ) );
add_filter( 'tribe_community_settings_tab', array( $this, 'community_tickets_settings' ) );
if ( $this->is_split_payments_enabled() ) {
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_adapter' ) );
}
add_action( 'woocommerce_order_item_meta_start', array( $this, 'add_order_item_details' ), 10, 3 );
add_action( 'wp_ajax_tribe-ticket-add-Tribe__Events__Tickets__Woo__Main', array( $this, 'ajax_handler_ticket_save' ), 9 );
add_action( 'wp_ajax_tribe-ticket-edit-Tribe__Events__Tickets__Woo__Main', array( $this, 'ajax_handler_ticket_save' ), 9 );
// Determine if the ticket price can be updated
add_filter( 'tribe_tickets_can_update_ticket_price', array( $this, 'can_update_ticket_price' ), 10, 2 );
add_filter( 'tribe_tickets_disallow_update_ticket_price_message', array( $this, 'disallow_update_ticket_price_message' ), 10, 2 );
add_action( 'tribe_tickets_plus_after_event_details_list', array( $this, 'order_report_organizer_data' ), 10, 2 );
add_filter( 'tribe_events_orders_report_site_fees_note', array( $this, 'order_report_site_fees_note' ), 10, 2 );
// Control the user's ability to delete tickets
add_filter( 'tribe_tickets_current_user_can_delete_ticket', array( $this, 'can_delete_existing_ticket' ), 10, 2 );
// Control the user's ability to check in attendees
add_filter( 'tribe_tickets_user_can_manage_attendees', array( $this, 'user_can_manage_own_event_attendees' ), 11, 3 );
// Compatibility with Event Tickets Plus
add_action( 'wp_ajax_tribe-ticket-add-Tribe__Tickets__Woo__Main', array( $this, 'ajax_handler_ticket_save' ), 9 );
add_action( 'wp_ajax_tribe-ticket-edit-Tribe__Tickets__Woo__Main', array( $this, 'ajax_handler_ticket_save' ), 9 );
// Ticket fee settings
add_filter( 'tribe_tickets_pass_fees_to_user', array( $this, 'pass_fees_to_user' ), 10, 2 );
add_filter( 'tribe_tickets_fee_percent', array( $this, 'get_fee_percent' ) );
add_filter( 'tribe_tickets_fee_flat', array( $this, 'get_fee_flat' ) );
add_filter( 'tribe_tickets_get_default_module', array( $this, 'filter_prevent_edd_provider' ) );
add_action( 'admin_init', array( $this, 'run_updates' ), 10, 0 );
}