dozent_get_course_settings( int $course_id, null $key = null, bool $default = false )

Get the Course Settings by course id and key


Description

While creating course, we save some settings from the course settings option, we can retrieve those settings by this function.

Example usage:

dozent_get_course_settings( $course_id, $settings_key );
dozent_get_course_settings( $course_id, $settings_key, $default_value );

Note: when you pass course id 0 or null, it will return from the current loop curse using get_the_ID()

See also


Parameters

$course_id

(int) (Required) Course ID

$key

(null) (Optional) settings key

Default value: null

$default

(bool) (Optional) default value

Default value: false


Return

(array|bool|mixed)


Source

File: includes/core-functions.php

	function dozent_get_course_settings( $course_id = 0, $key = null, $default = false ) {
		$course_id     = dozent_get_post_id( $course_id );
		$settings_meta = get_post_meta( $course_id, '_dozent_course_settings', true );
		$settings      = (array) maybe_unserialize( $settings_meta );

		if ( $key ){
			return dozent_array_get( $key, $settings, $default );
		}

		return $settings;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.