ulgm_signup_url
Filters the signup URL, allowing modification of the URL displayed on the page.
add_filter( 'ulgm_signup_url', $callback, 10, 2 );
Description
Filters the signup URL for LearnDash groups. Developers can modify the generated signup URL or replace it entirely. This hook fires when displaying group actions in the WordPress admin. The $post object is also provided for context.
Usage
add_filter( 'ulgm_signup_url', 'your_function_name', 10, 2 );
Parameters
-
$ulgm_signup_url(mixed) - This parameter holds the URL for the group signup page, which can be filtered by other plugins.
-
$post(mixed) - This parameter contains the URL for the group signup page.
Return Value
The filtered value.
Examples
/**
* Modify the signup URL displayed in the WordPress admin for groups.
*
* This function allows developers to alter the generated signup URL or
* even remove it entirely if needed, based on specific conditions.
*
* @param string $ulgm_signup_url The original signup URL HTML.
* @param WP_Post $post The current post object (expected to be a group post type).
* @return string The modified or original signup URL HTML.
*/
function my_custom_ulgm_signup_url( $ulgm_signup_url, $post ) {
// Example: Only show the signup URL for groups that are not yet published.
if ( 'draft' === $post->post_status ) {
// Remove the signup URL if the group is a draft.
return '';
}
// Example: Append a query parameter to the signup URL.
if ( ! empty( $ulgm_signup_url ) ) {
$ulgm_signup_url = str_replace( 'href="', 'href="' . add_query_arg( 'utm_source', 'admin_listing', '' ), $ulgm_signup_url );
}
return $ulgm_signup_url;
}
add_filter( 'ulgm_signup_url', 'my_custom_ulgm_signup_url', 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/classes/learn-dash-group-sign-up.php:1142
public static function render_signup_url_row_action( $actions, $post ){
if ( "groups" === (string) $post->post_type ){
if( current_user_can( 'manage_options' ) ){
$ulgm_signup_url = sprintf(
'<a href="%s">%s</a>',
site_url( 'sign-up/' . $post->post_name . '/' ),
esc_html__( 'Signup URL', 'uncanny-pro-toolkit' )
);
$actions['ulgm_signup_url'] = apply_filters( 'ulgm_signup_url', $ulgm_signup_url, $post );
}
}
return $actions;
}