Filter uncanny-learndash-groups

ulgm_group_management_email_users_reply_to

Filters the reply-to email address for group emails, allowing modification before sending to users.

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

Description

Fires when determining the "Reply-To" email address for group emails. Developers can filter this hook to override the default or saved "Reply-To" address. The hook passes the default email and the group ID, allowing for dynamic Reply-To settings based on the specific group.


Usage

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

Return Value

The filtered value.


Examples

/**
 * Example of modifying the 'Reply-To' email address for group management emails.
 *
 * This callback function demonstrates how to dynamically change the 'Reply-To'
 * email address based on the group ID or other custom logic.
 *
 * @param string $reply_to   The current 'Reply-To' email address.
 * @param int    $group_id   The ID of the group for which the email is being sent.
 * @return string The modified 'Reply-To' email address.
 */
add_filter( 'ulgm_group_management_email_users_reply_to', function( $reply_to, $group_id ) {
	// If the group ID is provided and it's a specific group we want to handle
	// differently, we can set a custom Reply-To for it.
	if ( $group_id && $group_id === 42 ) { // Example: If the group ID is 42
		return '[email protected]'; // Use a dedicated support email for this group
	}

	// Otherwise, return the original Reply-To address (which might be from settings
	// or the blog admin email).
	return $reply_to;
}, 10, 2 ); // Priority 10, accepts 2 arguments: $reply_to and $group_id

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-functions.php:1208

public static function ulgm_group_management_email_users_reply_to( $group_id = null ) {
		$reply_to = get_option( 'ulgm_reply_to', '' );

		$return = ! empty( $reply_to ) ? $reply_to : get_bloginfo( 'admin_email' );

		return apply_filters(
			'ulgm_group_management_email_users_reply_to',
			$return,
			$group_id
		);
	}


Scroll to Top