UM_USERROLECHANGE::define_trigger()

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


Source Source

File: src/integrations/ultimate-member/triggers/um-userrolechange.php

	public function define_trigger() {



		$trigger = array(
			'author'              => Automator()->get_author_name( $this->trigger_code ),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/ultimate-member/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - Ultimate Member */
			'sentence'            => sprintf( esc_attr__( "A user's role changes to {{a specific role:%1\$s}}", 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - Ultimate Member */
			'select_option_name'  => esc_attr__( "A user's role changes to {{a specific role}}", 'uncanny-automator' ),
			'action'              => 'set_user_role',
			'priority'            => 99,
			'accepted_args'       => 3,
			'validation_function' => array( $this, 'set_user_role' ),
			'options'             => [
				Automator()->helpers->recipe->wp->options->wp_user_roles(),
			],
		);

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

		return;
	}