ulgm_subscription_show_additional_seats_learn_more
Filters whether to display the "learn more" link for additional seats in the managed groups.
add_filter( 'ulgm_subscription_show_additional_seats_learn_more', $callback, 10, 1 );
Description
This filter allows developers to control the visibility of the "Learn More" link related to additional seats for managed groups. By returning `false`, you can hide this link. It's triggered when displaying the users table actions in the frontend.
Usage
add_filter( 'ulgm_subscription_show_additional_seats_learn_more', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
add_filter( 'ulgm_subscription_show_additional_seats_learn_more', 'my_custom_ulgm_show_learn_more_link', 10, 2 );
/**
* Conditionally show the "Learn More" link for additional seats based on subscription status and group ID.
*
* This function checks if the user is in a specific managed group and if their subscription allows
* displaying the "Learn More" link for adding more seats.
*
* @param bool $show_learn_more The default value, indicating whether to show the link.
* @param int $group_id The ID of the currently managed group.
*
* @return bool Whether the "Learn More" link should be displayed.
*/
function my_custom_ulgm_show_learn_more_link( $show_learn_more, $group_id ) {
// Example: Only show the "Learn More" link for a specific group ID.
$specific_group_id = 123; // Replace with the actual group ID you want to target.
if ( $group_id === $specific_group_id ) {
// Further checks can be added here, e.g., checking user capabilities, subscription level, etc.
// For this example, we'll just return true if it's the specific group.
return true;
}
// By default, if it's not the specific group, don't show the link,
// or rely on the default value passed to the filter.
return $show_learn_more;
}
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/templates/frontend-uo_groups/users-table-actions.php:196
<button class="ulgm-link uo-btn uo-inline uo-btn--small"
onclick="location.href='<?php echo esc_url_raw( $add_seats_link ); ?>'"
type="button">
<?php echo GroupManagementInterface::$ulgm_management_shortcode['text']['add_seats']; ?>
</button>
<?php
}
if ( true === apply_filters( 'ulgm_subscription_show_additional_seats_learn_more', true, GroupManagementInterface::$ulgm_current_managed_group_id ) ) {
echo $lm;
}
}
}
?>
</div>
</div>