ulgm_welcome_emails_check_real_group_id
Filters the group ID when checking for welcome emails to ensure it's a real group.
add_filter( 'ulgm_welcome_emails_check_real_group_id', $callback, 10, 1 );
Description
This filter hook runs when determining the true group ID for welcome emails. Developers can use it to override the default logic for identifying the parent group. If the filter returns `false`, the original `$group_id` will be used, bypassing ancestor checks.
Usage
add_filter( 'ulgm_welcome_emails_check_real_group_id', 'your_function_name', 10, 1 );
Parameters
-
$group_id(mixed) - This parameter is the default value returned by the filter if no other value is provided.
Return Value
The filtered value.
Examples
/**
* Example of how to use the ulgm_welcome_emails_check_real_group_id filter.
*
* This filter allows you to conditionally prevent the plugin from trying to find
* the "real" parent group ID. For example, if you know that a specific group
* ID should always be treated as its own group, you can return `true` from
* this filter to short-circuit the logic.
*/
add_filter(
'ulgm_welcome_emails_check_real_group_id',
function ( $should_check_real_group_id, $group_id ) {
// If the group_id is a specific known top-level group that we don't want
// to traverse ancestors for, then return true to stop the check.
// Replace '123' with an actual group ID you want to exclude.
if ( '123' === $group_id ) {
return true; // Prevent checking for a real group ID
}
// Otherwise, let the default logic proceed.
return $should_check_real_group_id;
},
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/helpers/shared-variables.php:22
public static function get_real_group_id( $group_id ) {
if ( false === apply_filters( 'ulgm_welcome_emails_check_real_group_id', false, $group_id ) ) {
return $group_id;
}
$ancestors = get_post_ancestors( $group_id );
$actual_group_id = array_pop( $ancestors );
return apply_filters( 'ulgm_welcome_emails_get_real_group_id', $actual_group_id, $group_id );
}