Lifterlms_Helpers::all_lf_memberships( string $label = null, string $option_code = 'LFMEMBERSHIP',  $any_option = true,  $is_all_label = false )


Parameters Parameters

$label

(string) (Optional)

Default value: null

$option_code

(string) (Optional)

Default value: 'LFMEMBERSHIP'


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/lifterlms/helpers/lifterlms-helpers.php

	public function all_lf_memberships( $label = null, $option_code = 'LFMEMBERSHIP', $any_option = true, $is_all_label = false ) {
		if ( ! $this->load_options ) {


			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}


		if ( ! $label ) {
			$label = esc_attr__( 'Membership', 'uncanny-automator' );
		}

		$args = [
			'post_type'      => 'llms_membership',
			'posts_per_page' => 9999,
			'orderby'        => 'title',
			'order'          => 'ASC',
			'post_status'    => 'publish',
		];


		$options = Automator()->helpers->recipe->options->wp_query( $args, $any_option, esc_attr__( 'Any membership', 'uncanny-automator' ), $is_all_label );

		$option = [
			'option_code'              => $option_code,
			'label'                    => $label,
			'input_type'               => 'select',
			'required'                 => true,
			// to setup example, lets define the value the child will be based on
			'current_value'            => false,
			'validation_type'          => 'text',
			'options'                  => $options,
			'relevant_tokens'          => [
				$option_code          => esc_attr__( 'Membership title', 'uncanny-automator' ),
				$option_code . '_ID'  => esc_attr__( 'Membership ID', 'uncanny-automator' ),
				$option_code . '_URL' => esc_attr__( 'Membership URL', 'uncanny-automator' ),
			],
			'custom_value_description' => esc_attr__( 'Membership ID', 'uncanny-automator' ),
		];

		return apply_filters( 'uap_option_all_lf_memberships', $option );
	}