RESTRICT_CONTENT_PURCHASESMEMBERSHIP::define_trigger()

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


Source Source

File: src/integrations/restrict-content/triggers/restrict-content-purchasesmembership.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/restrict-content/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - Wishlist Member */
			'sentence'            => sprintf( esc_attr__( 'A user purchases {{a membership level:%1$s}}', 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - Wishlist Member */
			'select_option_name'  => esc_attr__( 'A user purchases {{a membership level}}', 'uncanny-automator' ),
			'action'              => 'rcp_membership_post_activate',
			'priority'            => 5,
			'accepted_args'       => 2,
			'validation_function' => array( $this, 'user_purchases_membership_level' ),
			'options'             => [
				Automator()->helpers->recipe->restrict_content->options->get_membership_levels(
					null,
					$this->trigger_meta,
					[ 'any' => true ]
				),
			],
		);

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

		return;
	}