Tribe__Events__Community__Tickets__Main::get_payment_fee_setting( null|WP_Post $event = null )

Gets an event’s payment fee setting.


Parameters #

$event

(null|WP_Post) (Optional) Event object (if payment fee setting should be specific to event).

Default value: null


Top ↑

Return #

(string) Payment fee setting.


Top ↑

Source #

File: src/Tribe/Main.php

	public function get_payment_fee_setting( $event = null ) {
		if ( $event && ! $event instanceof WP_Post ) {
			$event = get_post( $event );
		}

		$options = get_option( self::OPTIONNAME, array() );

		$payment_fee_setting = isset( $options['payment_fee_setting'] ) ? $options['payment_fee_setting'] : $this->option_defaults['payment_fee_setting'];

		// If split payments are enabled, get the event creator's options
		if ( $event && $this->is_split_payments_enabled() ) {
			$event_creator = get_user_by( 'id', $event->post_author );
			$creator_options = Tribe__Events__Community__Tickets__Payment_Options_Form::get_meta( $event_creator->ID );

			if ( isset( $creator_options['payment_fee_setting'] ) ) {
				$payment_fee_setting = $creator_options['payment_fee_setting'];
			}
		}

		// default to absorb if the payment_fee_setting is unknown
		if ( ! in_array( $payment_fee_setting, $this->payment_fee_setting_options ) ) {
			$payment_fee_setting = $this->option_defaults['payment_fee_setting'];
		}

		return $payment_fee_setting;
	}