ulgm_other_similar_orders_limit
Filters the maximum number of similar orders to display, allowing customization of this core integration's output.
add_filter( 'ulgm_other_similar_orders_limit', $callback, 10, 1 );
Description
Filters the maximum number of "other orders with the same license" displayed on the LearnDash Group Leader settings page. Developers can use this hook to customize the displayed limit, for example, to show more or fewer related orders. The default limit is 15.
Usage
add_filter( 'ulgm_other_similar_orders_limit', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Adjust the limit for displaying "Other orders with the same license".
*
* This filter allows you to control the maximum number of similar orders
* that will be displayed on the group leader edit screen.
*
* @param int $limit The default limit for the number of similar orders to display.
* @return int The adjusted limit.
*/
add_filter( 'ulgm_other_similar_orders_limit', 'my_custom_ulgm_other_similar_orders_limit', 10, 1 );
function my_custom_ulgm_other_similar_orders_limit( $limit ) {
// Example: Increase the limit to 20 if the default is 15.
// In a real-world scenario, you might fetch this value from
// theme options, plugin settings, or conditionally based on other factors.
$new_limit = 20;
// Ensure we don't decrease the limit below a reasonable minimum,
// though this is a simple example.
if ( $new_limit < $limit ) {
return $limit;
}
return $new_limit;
}
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/classes/learndash/learndash-groups-post-edit-additions.php:503
if ( $other_orders ) {
?>
<h4><?php echo esc_html__( 'Other orders with the same license:', 'uncanny-learndash-groups' ); ?></h4>
<ol>
<?php
$k = 1;
$limit = apply_filters( 'ulgm_other_similar_orders_limit', 15 );
foreach ( $other_orders as $o_id ) {
if ( $k <= $limit ) {
$ordr = wc_get_order( $o_id );
?>
<li>
<?php printf( '<a href="%s">#%d %s %s</a>', get_edit_post_link( $o_id ), $o_id, $ordr->get_billing_first_name(), $ordr->get_billing_last_name() ); ?>
</li>