ulgm_group_management_enrolled_user_na_status
Filters the N/A status for enrolled users when managing a group.
add_filter( 'ulgm_group_management_enrolled_user_na_status', $callback, 10, 1 );
Description
Filters the 'N/A' status displayed for users enrolled in courses within the Uncanny Groups group management interface. Developers can modify this 'N/A' text or replace it entirely to reflect custom statuses or information when a user has no associated course progress data. This hook fires when displaying a user's status in the group management interface and no course progress is found.
Usage
add_filter( 'ulgm_group_management_enrolled_user_na_status', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example: Modify the 'N/A' status for users not enrolled in any courses within a group.
*
* This filter allows you to change the default 'N/A' text displayed for users
* who are part of a group but have not been assigned any courses within that group.
*
* @param string $na_status The default 'N/A' string.
* @param int $group_id The ID of the Uncanny LearnDash Group.
*
* @return string The modified status string.
*/
add_filter( 'ulgm_group_management_enrolled_user_na_status', function( $na_status, $group_id ) {
// For demonstration, let's change 'N/A' to 'No courses assigned'.
// In a real scenario, you might want to check group settings or user meta
// to provide a more dynamic or context-aware status.
$modified_status = __( 'No courses assigned', 'your-text-domain' );
// You could also conditionally change it based on the group ID.
// For example, if $group_id is 123, display a different message.
if ( absint( $group_id ) === 123 ) {
$modified_status = __( 'Group pending enrollment', 'your-text-domain' );
}
return $modified_status;
}, 10, 2 ); // Priority 10, accepting 2 arguments.
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/group-management/group-management-interface.php:1038
} else {
$status_id = 'not-started';
$status = '<div class="status status-not-started" data-status="not-started">' . __( 'Not Started', 'learndash' ) . '</div>';
}
}
if ( empty( $learndash_group_enrolled_courses ) ) {
$status = '<div class="status status-not-started" data-status="not-started">' . apply_filters( 'ulgm_group_management_enrolled_user_na_status', __( 'N/A', 'uncanny-learndash-groups' ), $group_id ) . '</div>';
}
$status = apply_filters( 'ulgm_group_management_enrolled_user_status', $status, $user, $group_id, $learndash_group_enrolled_courses, $completions_rearranged );
self::$ulgm_enrolled_users_data_dt[] = apply_filters(
'ulgm_group_management_enrolled_user_info',
(object) array(
'check' => self::table_checkbox( $user->ID ),