RESTRICT_CONTENT_ADD_MEMBERSHIP_LEVEL::define_action()

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


Source Source

File: src/integrations/restrict-content/actions/restrict-content-add-membership-level.php

	public function define_action() {



		$action = [
			'author'             => 'Uncanny Automator',
			'support_link'       => Automator()->get_author_support_link( $this->action_code, 'integration/restrict-content/' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Logged-in trigger - Popup Maker */
			'sentence'           => sprintf( esc_attr__( 'Add the user to {{a membership level:%1$s}}', 'uncanny-automator' ), $this->action_meta ),
			/* translators: Logged-in trigger - Popup Maker */
			'select_option_name' => esc_attr__( 'Add the user to {{a membership level}}', 'uncanny-automator' ),
			'priority'           => 11,
			'accepted_args'      => 3,
			'execution_function' => [ $this, 'add_rcp_membership' ],
			'options_group'      => [
				$this->action_meta => [
					Automator()->helpers->recipe->restrict_content->options->get_membership_levels(
						null,
						$this->action_meta,
						[ 'any' => false ]
					),
					Automator()->helpers->recipe->field->text_field( 'RCMEMBERSHIPEXPIRY', esc_attr__( 'Expiry date', 'uncanny-automator' ), true, 'text', '', false, esc_attr__( 'Leave empty to use expiry settings from the membership level, or type a specific date in the format YYYY-MM-DD', 'uncanny-automator' ) ),
				],
			],
		];

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