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

		$columns = array(
			'cb'      => '<input type="checkbox" />',
			'title'   => __( 'Lesson Title', 'lifterlms' ),
			'course'  => __( 'Course', 'lifterlms' ),
			'section' => __( 'Section', 'lifterlms' ),
			'prereq'  => __( 'Prerequisite', 'lifterlms' ),
			'quiz'    => __( 'Quiz', 'lifterlms' ),
			'author'  => __( 'Author', 'lifterlms' ),
			'date'    => __( 'Date', 'lifterlms' ),
		);

		return $columns;
	}

	/**
	 * Add filters to the top of the post table
	 *
	 * @since 3.12.0
	 *
	 * @param string $post_type Post Type of the current posts table.
	 * @param string $which     Positioning of the filters [top|bottom].
	 * @return void
	 */
	public function add_filters( $post_type, $which ) {

		// Only for the correct post type & position.
		if ( 'lesson' !== $post_type || 'top' !== $which ) {
			return;
		}

		$selected = isset( $_GET['llms_filter_course_id'] ) ? absint( $_GET['llms_filter_course_id'] ) : false;
		echo LLMS_Admin_Post_Tables::get_post_type_filter_html( 'llms_filter_course_id', 'course', $selected );

	}

	/**
	 * Manage content of custom lesson columns.
	 *
	 * @since 3.2.3
	 * @since 3.24.0 Unknown.
	 * @since 5.7.0 Replaced the call to the deprecated `LLMS_Lesson::get_parent_course()` method with `LLMS_Lesson::get( 'parent_course' )`.
	 * @since 7.1.0 Implemented content for the quiz column.
	 *
	 * @param string $column  Column key/name.
	 * @param int    $post_id WP Post ID of the lesson for the row.
	 * @return void
	 */
	public function manage_columns( $column, $post_id ) {

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


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.