UT_USER_IMPORTED_IN_GROUP::define_trigger()

Define and register the trigger by pushing it into the Automator object


Source Source

File: src/integrations/uncanny-toolkit/triggers/ut-user-imported-in-group.php

	public function define_trigger() {

		$all_groups = Automator()->helpers->recipe->learndash->options->all_ld_groups( null, $this->trigger_meta );
		if ( isset( $all_groups['relevant_tokens'] ) ) {
			unset( $all_groups['relevant_tokens'] );
		}

		$trigger = array(
			'author'              => Automator()->get_author_name( $this->trigger_code ),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/uncanny-toolkit/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			'meta'                => $this->trigger_meta,
			/* translators: Logged-in trigger - Uncanny Toolkit */
			'sentence'            => sprintf( esc_attr__( 'A user is imported to {{a LearnDash group:%1$s}}', 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - Uncanny Toolkit */
			'select_option_name'  => esc_attr__( 'A user is imported to {{a LearnDash group}}', 'uncanny-automator' ),
			'action'              => 'uo_after_user_row_imported',
			'priority'            => 20,
			'accepted_args'       => 4,
			'validation_function' => array( $this, 'a_user_is_imported' ),
			'options'             => array(
				$all_groups,
			),
		);

		Automator()->register->trigger( $trigger );
	}