CourseCurriculum::is_curriculum_locked( $content,  $curriculum,  $course_id )


Source

File: classes/CourseCurriculum.php

	public function is_curriculum_locked( $content, $curriculum, $course_id ) {
		if ( ! empty( $content ) ) {
			return $content;
		}

		$course = dozent_get_course( $course_id );

		if ( $course->is_public() && ( $curriculum->post_type === 'dozent_lecture' ) ) {
			return $content;
		}

		$locked_message = '';

		if ( ! is_user_logged_in() ) {
			$locked_message = __( 'You must log in before access the course', 'dozent' );

			return dozent_curriculum_locked_content( $curriculum, $locked_message, false );
		}

		/**
		 * User is now logged in
		 */

		if ( ! $course->has_permission() ) {

			$locked_message = sprintf( __( 'You have no permission to view this contents. Go to %s to gain access.', 'dozent' ), '<a href=" ' . $course->permalink() . ' "> course page </a>' );

			return dozent_curriculum_locked_content( $curriculum, $locked_message, false );
		}

		return $content;
	}