LLMS_Meta_Box_Access::get_fields()

Define metabox fields


Return Return

(array)


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.access.php

	public function get_fields() {

		$post_type = get_post_type_object( $this->post->post_type );

		$restrictions = get_post_meta( $this->post->ID, $this->prefix . 'restricted_levels', true );

		if ( ! $restrictions ) {
			$restrictions = array();
		}

		return array(

			array(
				'title'  => __( 'Membership Access', 'lifterlms' ),
				'fields' => array(
					array(
						'controls'   => '#' . $this->prefix . 'restricted_levels',
						'desc_class' => 'd-1of2 t-1of2 m-1of2',
						'id'         => $this->prefix . 'is_restricted',
						'label'      => sprintf( _x( 'Restrict this %s', 'apply membership restriction to post type', 'lifterlms' ), $post_type->labels->singular_name ),
						'type'       => 'checkbox',
						'value'      => 'yes',
					),
					array(
						'class'           => 'input-full llms-select2-post',
						'data_attributes' => array(
							'post-type' => 'llms_membership',
						),
						'desc'            => sprintf( __( 'Visitors must belong to one of these memberships to access this %s', 'lifterlms' ), strtolower( $post_type->labels->singular_name ) ),
						'id'              => $this->prefix . 'restricted_levels',
						'label'           => __( 'Memberships', 'lifterlms' ),
						'multi'           => true,
						'type'            => 'select',
						'value'           => llms_make_select2_post_array( $restrictions ),
					),
				),
			),
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.