LLMS_Lab_Pricing_Table_Module::get_product_id( obj $settings )

Get the product ID to be used based of BB module settings.


Parameters Parameters

$settings

(obj) (Required) BB node settings object.


Top ↑

Return Return

(int|false)


Top ↑

Source Source

File: includes/beaver-builder/modules/pricing-table/class.llms.lab.pricing.table.module.php

	public function get_product_id( $settings ) {

		$type = $settings->llms_product_type;
		if ( ! $type ) {
			$id = get_the_ID();
		} elseif ( 'course' === $type || 'membership' === $type ) {
			$key = sprintf( 'llms_%s_id', $type );
			$id  = $settings->$key;
		}

		if ( in_array( get_post_type( $id ), array( 'lesson', 'llms_quiz' ), true ) ) {
			$course = llms_get_post_parent_course( $id );
			$id     = $course->get( 'id' );
		}

		// If the current id isn't a course or membership don't proceed.
		if ( ! in_array( get_post_type( $id ), array( 'course', 'llms_membership' ), true ) ) {
			return false;
		}

		return $id;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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