Notifications
Clear all

[Solved] Conversation Link

7 Posts
2 Users
1 Reactions
1,574 Views
st7878
Posts: 24
Topic starter
(@st7878)
Eminent Member
Joined: 3 years ago

The email notification is missing a link to the message. Instead, the topic is indicated. Everything is indicated correctly in the settings (see screenshots)

1
2
mail

 

6 Replies
st7878
Posts: 24
Topic starter
(@st7878)
Eminent Member
Joined: 3 years ago

and if you use the [msg] shortcode, then the letter contains the text of the message itself and a link to it. But I don't want to transmit the text of the message. I only need a link. For users to visit the site ...

5 Replies
Kyle
 Kyle
(@kylew)
Joined: 3 years ago

Prominent Member
Posts: 728

@st7878,

I don't follow you, please explain correctly what's your issue.

st7878
(@st7878)
Joined: 3 years ago

Eminent Member
Posts: 24

@kylew in the message settings, I turned it on so that the letter contains a link to the message. the title of the message is sent to the email instead of the link

st7878
(@st7878)
Joined: 3 years ago

Eminent Member
Posts: 24

@kylew there should be a link, not a title

Kyle
 Kyle
(@kylew)
Joined: 3 years ago

Prominent Member
Posts: 728

@st7878,

Go to wp-content/plugins/wpforo-private-messages/wpforopm.php file, search the below function(code) 

public function send_notification_mail($args){

and replace the hole code with this one

public function send_notification_mail($args){
    if( !$this->options['email_notification'] ) return false;

    if( $args['folderid'] == WPF()->current_object['pm_folderid'] ){
        $folder = WPF()->current_object['pm_folder'];
        $userids = $this->folder->get_userids();
        $exclude_sendmail = $this->folder->get_exclude_sendmail();
    }else{
        $folder = $this->folder->get_folder($args['folderid']);
        $userids = $this->folder->get_userids($folder);
        $exclude_sendmail = $this->folder->get_exclude_sendmail($folder);
    }

    $userids = array_diff($userids, $exclude_sendmail);

    if( !empty($userids) ){
        $folder_title = $this->folder->make_title($folder);
        $subject = $this->options['new_pm_notification_email_subject'];
        $message = $this->options['new_pm_notification_email_message'];
        $from = ( $member = WPF()->member->get_member($args['fromuserid']) ) ? wpforo_user_dname($member) : '';
        $from_tags = array("[conversation]", "[from]", "[msg]");
        $to_words   = array(
         '<a href="' . esc_url($this->get_conversation_url($folder)) . '"><strong>' . sanitize_text_field($folder_title) . '</strong></a>',
         '<br><em>' . $from . '</em>',
         '<br><br> '. $args['message'] .' <a href="' . esc_url($this->get_conversation_url($folder)) . '"> ' . wpforo_phrase('Conversation Link', false) . ' >></a>'
        );
        $subject = stripslashes(str_replace($from_tags, $to_words, $subject));
        $message = stripslashes(str_replace($from_tags, $to_words, $message));
        $message = wpforo_kses($message, 'email');
        $headers = wpforo_mail_headers();

        add_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type' );

        foreach ($userids as $userid){
            if( WPF()->member->is_online($userid) ) continue;
            $user = get_userdata($userid);
            wp_mail( $user->user_email, sanitize_text_field($subject), $message, $headers );
        }

        remove_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type' );
        return TRUE;
    }

    return false;
}

It's almost the same code, only changed one line, so you can see where the code starts and ends.

st7878
(@st7878)
Joined: 3 years ago

Eminent Member
Posts: 24

@kylew you did not understand me))), but thanks for the code. I modified it. and did the right thing.

It was:

  • [conversation] - Conversation link Title topics of conversation
  • [from] - Sender Display Name - OK
  • [msg] - Message content - Message content + Conversation link 

i did as stated in plugin settings:

  • [conversation] - Conversation link - ОК
  • [from] - Sender Display Name - ОК
  • [msg] - Message content - ОК (Title topics+Message content)

Fix it in the plugin. The code is like this:

$to_words   = array(
         '<a href="' . esc_url($this->get_conversation_url($folder)) . '"> ' . wpforo_phrase('Conversation Link', false) . ' >></a>',
         '<em> ' . $from . '</em>',
         '<strong> ' . sanitize_text_field($folder_title) . '</strong><br>'. $args['message']
        );

 

Share:
Scroll to top