Reply To: Problem with message_url and announcement_url in emails sent to users


Home Forums Front End PM PRO Problem with message_url and announcement_url in emails sent to users Reply To: Problem with message_url and announcement_url in emails sent to users

#12630
Shamim Hasan
Keymaster

Please add following code in your theme’s (child theme’s if any) functions.php

add_filter( 'fep_eb_email_legends', function( $legends, $post, $user_email ){
	if( ! function_exists( 'um_fetch_user' ) || ! function_exists( 'fep_get_userdata' ) || ! function_exists( 'um_user_profile_url' ) )
	return $legends;
	
	if( is_object( $post ) )
	um_fetch_user( fep_get_userdata( $user_email, 'ID', 'email') );
	
	$legends['um_message_url'] = array(
		'description' => __('URL of message if UM enabled', 'front-end-pm'),
		'where' => array( 'newmessage', 'reply' ),
		'replace_with' => ! empty( $post->ID ) ? esc_url_raw( add_query_arg( array( 'profiletab' => 'fep-um', 'fepaction' => 'viewmessage', 'fep_id' => $post->ID ), um_user_profile_url() ) ) : ''
	);
	$legends['um_announcement_url'] = array(
		'description' => __('URL of announcement if UM enabled', 'front-end-pm'),
		'where' => 'announcement',
		'replace_with' => ! empty( $post->ID ) ? esc_url_raw( add_query_arg( array( 'profiletab' => 'fep-um', 'fepaction' => 'view_announcement', 'fep_id' => $post->ID ), um_user_profile_url() ) ) : ''
	);
	
	return $legends;
}, 10, 3);

Then use {{um_message_url}} and {{um_announcement_url}} respectively.
Let me know if it works. i will update plugin accordingly.