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

This topic is: Resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #12619
    STEVE
    Participant

    Hello,

    I am having a problem with the message_url and announcement_url in emails sent to users. The links they produce are not working properly. It should be noted that I am a paid Front End PM PRO customer and I am also using the Front End PM – Ultimate Member Integration plugin. The integration has been working great, until now.

    This is the code in the email for Messages.
    Message URL: <a href="{{message_url}}">{{message_url}}</a>
    When the email arrives, the Message URL is including the name of the person that sent the email in the URL. For example, the following is a Message URL from an email message I sent to a test user. Notice how it contains my name in the URL. When the user clicks it, it takes the user to the homepage of the website and not the actual message, even if the user is already logged in.
    https://mysite_dot_com/profile/steve.soler/?fepaction=viewmessage&fep_id=1063&profiletab=fep-um
    I copied the URL, removed my name so that it looks like this..
    https://mysite_dot_com/profile/?fepaction=viewmessage&fep_id=1063&profiletab=fep-um
    and when I pasted it into the web browser, it goes directly to the message, as it should.
    Can you figure out why it’s incorrectly including the name of the sender in the URL?

    Next problem…
    This is the code in the email for Annoucements.
    Announcement URL: <a href="{{announcement_url}}">{{announcement_url}}</a>
    When the email arrives, the URL looks like this
    https://mysite_dot_com/profile/?fepaction=viewannouncement&fep_id=1064
    I don’t know if this URL is correct or not. When the user clicks the link, the web browser opens, and since the user is already logged in, the user’s name is now included in the URL in the browser. But instead of taking the user to the Announcement, they are taken to their Ultimate Members Profile page on the site. The strange thing is that even though they are taken to their profile page, the URL in the browser still has the ?fepaction stuff as seen below.
    https://mysite_dot_com/profile/test.user/?fepaction=viewannouncement&fep_id=1064
    Can you figure out why they are not being taken to the Announcement?

    Let me know if you need temp admin access to the site. The site is live, but only for development and testing. I don’t want to post it publicly, so I can send it to you privately.

    Thanks!

    #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.

    #12635
    STEVE
    Participant

    Thank you for helping with this.

    The message link in emails is now working 100%. The announcement link in emails is not working. This time when the user clicks the announcement URL link in the email they are taken to the Message Box, not the announcement.

    This is the link that is in the email.
    https://mysite_dot_com/profile/test.user/?profiletab=fep-um&fepaction=viewannouncement&fep_id=1070

    Let me know what you think.

    Thanks!

    #12638
    Shamim Hasan
    Keymaster

    I have corrected above code. Please use this code and try.
    Let me know.

    #12651
    STEVE
    Participant

    That worked! Thanks!

    #12657
    Shamim Hasan
    Keymaster

    I have updated “Front End PM – Ultimate Member Integration”. Please update that extension and remove this custom code. Then use original {{message_url}} and {{announcement_url}}. try and let me know.

    #12689
    STEVE
    Participant

    @shamim

    I did everything you requested and tested afterwards. All is working as it should! Thanks again for fixing this!

    STEVE

Viewing 7 posts - 1 through 7 (of 7 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.