uo_ld_group_signup_registered_message
Filters the success message displayed after a user registers for a group.
add_filter( 'uo_ld_group_signup_registered_message', $callback, 10, 1 );
Description
Filters the "Congratulations! You are now registered on this site." message shown after a user successfully signs up for a group. Developers can modify this message to provide custom confirmation text or additional instructions. The original message includes a placeholder for login details.
Usage
add_filter( 'uo_ld_group_signup_registered_message', 'your_function_name', 10, 1 );
Parameters
-
$group_post_id(mixed) - This parameter is a translatable string that displays a congratulatory message to users who have successfully registered for a group.
Return Value
The filtered value.
Examples
/**
* Filters the "registered on this site" message after a user signs up for a group.
*
* This example appends the group name to the default registration message.
*
* @param string $message The default registration message.
* @param int $group_post_id The ID of the group the user registered for.
*
* @return string The modified registration message.
*/
function my_custom_group_signup_registered_message( $message, $group_post_id ) {
// Check if the group_post_id is valid and a group exists.
if ( is_numeric( $group_post_id ) && $group_post_id > 0 ) {
$group_post = get_post( $group_post_id );
if ( $group_post instanceof WP_Post && $group_post->post_type === 'group' ) {
// Get the group title and escape it for security.
$group_title = esc_html( $group_post->post_title );
// Append the group title to the existing message.
$message .= ' ' . sprintf(
esc_html__( 'You have successfully joined the group: %s', 'your-text-domain' ),
$group_title
);
}
}
// Always return the message, whether modified or not.
return $message;
}
add_filter( 'uo_ld_group_signup_registered_message', 'my_custom_group_signup_registered_message', 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/single-group.php:123
<?php } else { ?>
<p><?php echo esc_html__( 'Congratulations! You are now registered on this site. You will receive an email shortly with login details.', 'uncanny-pro-toolkit' ); ?></p>
<?php } ?>
<?php
}
} elseif ( is_user_logged_in() && isset( $_REQUEST['registered'] ) ) {
?>
<p><?php echo wp_kses_post( apply_filters( 'uo_ld_group_signup_registered_message',
esc_html__( 'Congratulations! You are now registered on this site.', 'uncanny-pro-toolkit' ),
$group_post_id
) ); ?></p>
<?php
} elseif ( is_user_logged_in() && isset( $_REQUEST['joined'] ) ) {
?>
<p>