[memb_cohort_info]

Description

Looks up the current user's cohort for a course and outputs the value of a cohort variable. The course is resolved from the course_id attribute, or from the current post context (a course post, or a post resolved through the wpal/torii/cohorts/resolve_course_id filter, typically a lesson belonging to a course).

Special keys handled by the cohort record itself: cohort_name, cohort_start_date, course_id. Any other key is looked up in the cohort's variables.

When the user isn't logged in, has no cohort, or the key doesn't exist, the default value is returned (escaped).

Shortcode Examples

[memb_cohort_info key="instructor_name"]

Cohort name on a course page:

Your cohort: [memb_cohort_info key="cohort_name" default="General admission"]

Explicit course:

[memb_cohort_info key="cohort_start_date" course_id="123"]

Shortcode Parameters

key

The cohort variable to retrieve. Required, empty renders nothing. Default: ''.

default

Value returned when the user, cohort, course, or key is missing. Default: ''.

course_id

Course post ID. When 0, resolved from the current post context. Default: 0.

user_id

User ID. When 0, the current user. Default: 0.

Shortcode Attributes

Attribute Value
Conditional No
Nestable No
Accepts formatting No