Filter uncanny-learndash-groups

ulgm_subscription_additional_seats_learn_more_link

Filters the URL for the "Learn More" link related to additional seats for WooCommerce subscriptions.

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

Description

This filter allows modification of the "learn more" link for additional seats in WooCommerce subscriptions. Developers can change the URL or replace the link entirely before it's displayed. It fires when checking for the display of the additional seats feature.


Usage

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

Return Value

The filtered value.


Examples

<?php
/**
 * Filter the 'learn more' link for additional seats in WooCommerce subscriptions.
 *
 * This function allows you to dynamically modify the URL of the 'learn more' link
 * that appears when users are looking to add seats to a WooCommerce subscription-based group.
 * You can use this to point to specific documentation, pricing pages, or custom landing pages.
 *
 * @param string $learn_more_link The default 'learn more' link URL retrieved from WordPress options.
 * @param array  $args            An empty array in this specific hook's context.
 * @return string The modified or original 'learn more' link URL.
 */
add_filter( 'ulgm_subscription_additional_seats_learn_more_link', function( $learn_more_link, $args ) {
	// Example: If the default link is empty, provide a custom URL.
	// This could be a URL to your plugin's documentation on adding seats.
	if ( empty( $learn_more_link ) ) {
		$learn_more_link = 'https://your-plugin-website.com/docs/adding-seats-to-subscriptions/';
	}

	// Example: Append a query parameter based on the current group ID if available.
	// Note: Accessing group ID directly might be complex depending on the plugin's internal structure.
	// For demonstration, let's assume you have a way to get the current group ID.
	// In a real scenario, you'd likely get this from a global variable or a helper function.
	// For this example, we'll pretend we have $current_group_id available.
	// $current_group_id = SomePluginHelper::get_current_group_id();
	// if ( ! empty( $current_group_id ) ) {
	// 	$learn_more_link = add_query_arg( 'group_id', $current_group_id, $learn_more_link );
	// }

	// You could also use the $args array if it were populated, but in this hook, it's typically empty.
	// if ( ! empty( $args['some_key'] ) ) {
	//     $learn_more_link = esc_url( $args['some_key'] );
	// }

	return esc_url( $learn_more_link );
}, 10, 2 );
?>

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:176
src/classes/woocommerce/woocommerce-modify-group.php:389

if ( $add_seats_button && $license_exists ) {
				if ( Utilities::if_woocommerce_active() && empty( get_post_meta( GroupManagementInterface::$ulgm_current_managed_group_id, SharedFunctions::$code_group_downgraded, true ) ) && empty( get_post_meta( GroupManagementInterface::$ulgm_current_managed_group_id, '_ulgm_is_upgraded', true ) ) && empty( get_post_meta( GroupManagementInterface::$ulgm_current_managed_group_id, '_ulgm_is_custom_group_created', true ) ) ) {
					$add_seats_link = GroupManagementInterface::$ulgm_management_shortcode['text']['add_seats_link'];
					$lm             = '';
					$show_button    = true;
					if ( Utilities::if_woocommerce_subscription_active() && 'yes' === get_post_meta( GroupManagementInterface::$ulgm_current_managed_group_id, '_uo_subscription_group', true ) ) {
						if ( class_exists( 'uncanny_learndash_groupsWoocommerceLicenseSubscription' ) && WoocommerceLicenseSubscription::is_woo_subscriptions_add_seats_enabled() ) {
							$learn_more_link = apply_filters( 'ulgm_subscription_additional_seats_learn_more_link', get_option( 'woo_subscription_allow_additional_seats_learn_more_link', '' ), array() );
							$learn_more      = apply_filters( 'ulgm_subscription_additional_seats_learn_more', '<span class="dashicons dashicons-external"></span>' );
							if ( ! empty( $learn_more_link ) ) {
								$lm = sprintf( '<a href="%s" target="_blank">%s</a>', $learn_more_link, $learn_more );
							}
							$add_seats_link = "$add_seats_link&is_subscription_group=yes";
						} else {
							$show_button = false;


Scroll to Top