BDB_USERPOSTREPLYFORUM::match_condition( int $topic_id, int $forum_id, null|array $recipes = null, null|string $trigger_meta = null, null|string $trigger_code = null, null|string $trigger_second_code = null )

Match condition for form field and value.


Parameters Parameters

$topic_id

(int) (Required) .

$forum_id

(int) (Required) .

$recipes

(null|array) (Optional) .

Default value: null

$trigger_meta

(null|string) (Optional) .

Default value: null

$trigger_code

(null|string) (Optional) .

Default value: null

$trigger_second_code

(null|string) (Optional) .

Default value: null


Top ↑

Return Return

(array|bool)


Source Source

File: src/integrations/buddyboss/triggers/bdb-userpostreplyforum.php

	public function match_condition( $topic_id, $forum_id, $recipes = null, $trigger_meta = null, $trigger_code = null, $trigger_second_code = null ) {
		if ( null === $recipes ) {
			return false;
		}

		$recipe_ids = array();
		foreach ( $recipes as $recipe ) {
			foreach ( $recipe['triggers'] as $trigger ) {
				if ( key_exists( 'BDBFORUMS', $trigger['meta'] ) && ( $trigger['meta']['BDBFORUMS'] == - 1 || $trigger['meta']['BDBFORUMS'] == $forum_id ) ) {
					if ( key_exists( $trigger_meta, $trigger['meta'] ) && ( $trigger['meta'][ $trigger_meta ] == - 1 || $trigger['meta'][ $trigger_meta ] == $topic_id ) ) {
						$recipe_ids[ $recipe['ID'] ] = $trigger['ID'];
					}
				}
			}
		}

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

		return false;
	}