Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Student::add_membership_level( int $membership_id )

Add the student to a LifterLMS Membership


Parameters Parameters

$membership_id

(int) (Required) WP Post ID of the membership


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/models/model.llms.student.php

	 */
	private function add_membership_level( $membership_id ) {

		// Add the user to the membership level.
		$membership_levels = $this->get_membership_levels();
		array_push( $membership_levels, $membership_id );
		update_user_meta( $this->get_id(), '_llms_restricted_levels', $membership_levels );

		// If there's auto-enroll courses, enroll the user in those courses.
		$autoenroll_courses = get_post_meta( $membership_id, '_llms_auto_enroll', true );
		if ( $autoenroll_courses ) {

			foreach ( $autoenroll_courses as $course_id ) {

				$this->enroll( $course_id, 'membership_' . $membership_id );

			}
		}



Top ↑

Changelog Changelog

Changelog
Version Description
2.2.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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