LLMS_Admin_Post_Table_Lessons::manage_columns( string $column, int $post_id )

Manage content of custom lesson columns


Parameters Parameters

$column

(string) (Required) Column key/name.

$post_id

(int) (Required) WP Post ID of the lesson for the row.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/post-types/post-tables/class.llms.admin.post.table.lessons.php

	public function manage_columns( $column, $post_id ) {

		$lesson = llms_get_post( $post_id );
		if ( ! $lesson ) {
			return;
		}

		switch ( $column ) {

			case 'course':
				$course    = $lesson->get( 'parent_course' );
				$edit_link = get_edit_post_link( $course );

				if ( ! empty( $course ) ) {
					printf( '<a href="%1$s">%2$s</a>', $edit_link, get_the_title( $course ) );
				}

				break;

			case 'section':
				$section = $lesson->get_parent_section();
				if ( ! empty( $section ) ) {
					echo get_the_title( $section );
				}

				break;

			case 'prereq':
				if ( $lesson->has_prerequisite() ) {

					$prereq    = $lesson->get( 'prerequisite' );
					$edit_link = get_edit_post_link( $prereq );

					if ( $prereq ) {

						printf( '<a href="%1$s">%2$s</a>', $edit_link, get_the_title( $prereq ) );

					} else {

						echo '&ndash;';

					}
				} else {

					echo '&ndash;';

				}

				break;

		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.7.0 Replaced the call to the deprecated LLMS_Lesson::get_parent_course() method with LLMS_Lesson::get( 'parent_course' ).
3.24.0 Unknown.
3.2.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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