WCM_ADDUSER::define_trigger()

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


Source Source

File: src/integrations/wc-memberships/triggers/wcm-adduser.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/woocommerce-memberships/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - WooCommerce Memberships */
			'sentence'            => sprintf( esc_attr__( 'A user is added to {{a membership plan:%1$s}}', 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - WooCommerce Memberships */
			'select_option_name'  => esc_attr__( 'A user is added to {{a membership plan}}', 'uncanny-automator' ),
			'action'              => 'wc_memberships_user_membership_saved',
			'priority'            => 99,
			'accepted_args'       => 2,
			'validation_function' => array( $this, 'wc_user_added_to_membership_plan' ),
			'options'             => [
				Automator()->helpers->recipe->wc_memberships->options->wcm_get_all_membership_plans( null, $this->trigger_meta,
					[ 'is_any' => true ] ),
			],
		);

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