ulgm_admin_signup_link
Filters the admin signup link for groups, allowing modification before it's displayed to users.
add_filter( 'ulgm_admin_signup_link', $callback, 10, 3 );
Description
Filters the admin-only sign-up link for a specific group. Developers can modify the URL or its components before it's displayed, allowing for custom redirect behavior or link manipulation. The hook provides the group ID and key for context.
Usage
add_filter( 'ulgm_admin_signup_link', 'your_function_name', 10, 3 );
Parameters
-
$ulgm_admin_signup_link(mixed) - This parameter contains the generated sign-up link for the group, which can be modified by filters.
-
$group_post(mixed) - This parameter contains the URL for the admin signup link that can be filtered.
-
$group_key(mixed) - This parameter contains the `WP_Post` object representing the group for which the signup link is being generated.
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to use the ulgm_admin_signup_link filter.
*
* This example demonstrates how to modify the admin signup link for a group,
* perhaps to add additional tracking parameters or to conditionally alter the link.
*
* @param string $ulgm_admin_signup_link The original admin signup link.
* @param WP_Post $group_post The current group post object.
* @param string $group_key The unique group key.
* @return string The modified admin signup link.
*/
function my_custom_admin_signup_link_filter( $ulgm_admin_signup_link, $group_post, $group_key ) {
// Example: Add a custom tracking parameter to the signup link.
// This could be useful for analytics or to identify where users signed up from.
if ( is_a( $group_post, 'WP_Post' ) && ! empty( $group_key ) ) {
$custom_tracking_param = 'utm_source=admin-signup';
$ulgm_admin_signup_link = add_query_arg( $custom_tracking_param, $ulgm_admin_signup_link );
}
// You could also conditionally return a different link altogether based on group properties.
// For example:
// if ( $group_post->post_name === 'special-group' ) {
// $ulgm_admin_signup_link = 'https://example.com/special-signup-page/?group_id=' . $group_post->ID;
// }
return $ulgm_admin_signup_link;
}
add_filter( 'ulgm_admin_signup_link', 'my_custom_admin_signup_link_filter', 10, 3 );
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/single-group.php:61
'gid' => $group_post_id,
),
site_url( 'sign-up/' . $group_post->post_name . '/' )
) . '&' . $group_key;
printf(
'<h2>' . esc_attr__( 'Shown to admins only.', 'uncanny-pro-toolkit' ) . '</h2>' . '<p>' . esc_attr__( 'The sign up link for this group is:', 'uncanny-pro-toolkit' ) . ' <br /><a href="%1$s" >%1$s</a></p>',
apply_filters( 'ulgm_admin_signup_link', $ulgm_admin_signup_link, $group_post, $group_key )
);
}
} else {
?>
<article <?php post_class(); ?>>
<?php
if ( ! is_user_logged_in() ) {