Filter tin-canny-learndash-reporting

uo_tincanny_uotc_lesson_report_page_length

Filters the number of lessons displayed per page in the Tincanny lesson report.

add_filter( 'uo_tincanny_uotc_lesson_report_page_length', $callback, 10, 1 );

Description

Allows developers to filter the default page length (items per page) for lesson and topic reports. This filter enables customization of how many items are displayed in the report table, offering flexibility in how data is presented to users.


Usage

add_filter( 'uo_tincanny_uotc_lesson_report_page_length', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

/**
 * Filter the default page length for the lesson report to display 25 items per page.
 *
 * This allows administrators to change the number of lessons displayed on a single page
 * in the lesson report to improve readability or performance depending on their needs.
 *
 * @param int $default_page_length The default number of items to display per page.
 * @return int The new number of items to display per page.
 */
add_filter( 'uo_tincanny_uotc_lesson_report_page_length', function( $default_page_length ) {
	// Set the desired number of items per page.
	$new_page_length = 25;

	// Return the new page length.
	return $new_page_length;
}, 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/reporting/learndash/frontend-reports/lesson-topic-reports.php:369

'customColumnLabels' => array(
					'customizeColumns'     => __( 'Customize columns', 'uncanny-learndash-reporting' ),
					'hideCustomizeColumns' => __( 'Hide customize columns', 'uncanny-learndash-reporting' ),
				),
			),
			'columns'          => $columns,
			'loadingAnimation' => $this->loading_animation(),
			'pageLength'	   => apply_filters( 'uo_tincanny_uotc_lesson_report_page_length', 10 ),
		);
	}

	/**
	 * Get the HTML for the loading animation.
	 *
	 * @return string

Scroll to Top