WPJM_JOBAPPLICATION::match_condition( $job_id, null $recipes = null, null $trigger_meta = null, null $trigger_code = null )


Parameters Parameters

$terms

(Required)

$recipes

(null) (Optional)

Default value: null

$trigger_meta

(null) (Optional)

Default value: null

$trigger_code

(null) (Optional)

Default value: null


Top ↑

Return Return

(array|bool)


Source Source

File: src/integrations/wp-job-manager/triggers/wpjm-jobapplication.php

	public function match_condition( $job_id, $recipes = null, $trigger_meta = null, $trigger_code = null ) {

		if ( null === $recipes ) {
			return false;
		}

		$recipe_ids     = array();
		$entry_to_match = $job_id;

		foreach ( $recipes as $recipe ) {
			foreach ( $recipe['triggers'] as $trigger ) {
				if ( key_exists( $trigger_meta, $trigger['meta'] ) && ( (int) $trigger['meta'][ $trigger_meta ] === (int) $entry_to_match || $trigger['meta'][ $trigger_meta ] === "-1" ) ) {
					$recipe_ids[ $recipe['ID'] ] = $trigger['ID'];
					break;
				}
			}
		}

		if ( ! empty( $recipe_ids ) ) {
			return array(
				'recipe_ids' => $recipe_ids,
				'result'     => true,
			);
		}

		return false;
	}