MP_PURCHASEPRODUCTRECURRING::define_trigger()

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


Source Source

File: src/integrations/memberpress/triggers/mp-purchaseproductrecurring.php

	public function define_trigger() {



		$trigger = array(
			'author'              => Automator()->get_author_name(),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/memberpress/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - MemberPress */
			'sentence'            => sprintf( esc_attr__( 'A user purchases {{a recurring subscription product:%1$s}}', 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - MemberPress */
			'select_option_name'  => esc_attr__( 'A user purchases {{a recurring subscription product}}', 'uncanny-automator' ),
			'action'              => 'mepr-event-transaction-completed',
			'priority'            => 20,
			'accepted_args'       => 1,
			'validation_function' => array( $this, 'mp_product_purchased' ),
			'options'             => [
				Automator()->helpers->recipe->memberpress->options->all_memberpress_products_recurring( null, $this->trigger_meta, [ 'uo_include_any' => true ] ),
			],
		);

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