Mec_Event_Tokens::get_event_id_from_trigger_log_meta( mixed $user_id, mixed $meta_key, mixed $trigger_id, mixed $trigger_log_id )

Get the event id from the trigger log table.


Parameters Parameters

$user_id

(mixed) (Required) The user id.

$meta_key

(mixed) (Required) The meta key.

$trigger_id

(mixed) (Required) The trigger id.

$trigger_log_id

(mixed) (Required) The trigger log id.


Top ↑

Return Return

(mixed) The event ID | Empty String when not found.


Source Source

File: src/integrations/modern-events-calendar/tokens/mec-event-tokens.php

	public function get_event_id_from_trigger_log_meta( $user_id, $meta_key, $trigger_id, $trigger_log_id ) {

		global $wpdb;

		if ( empty( $meta_key ) || empty( $trigger_id ) || empty( $trigger_log_id ) ) {
			return '';
		}

		$meta_value = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT meta_value
				FROM {$wpdb->prefix}uap_trigger_log_meta
				WHERE user_id = %d
				AND meta_key = %s
				AND automator_trigger_id = %d
				AND automator_trigger_log_id = %d
				ORDER BY ID DESC LIMIT 0,1",
				$user_id,
				$meta_key,
				$trigger_id,
				$trigger_log_id
			)
		);

		if ( ! empty( $meta_value ) ) {
			return maybe_unserialize( $meta_value );
		}

		return '';
	}