Reply to the message after the comment to the user


Home Forums Front End PM PRO Reply to the message after the comment to the user

This topic is: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10379
    laowei
    Participant

    This is my code, but it does not seem to work

    function fep_cus_user_reply_comment_message($comment_ID) {
    	global $wpdb;
    	$comment = get_comment($comment_ID);
      $comment_author_email = trim($comment->comment_author_email);
      $parent_id = $comment->comment_parent ? $comment->comment_parent : '';
    	$author_name = get_userdata($comment->user_id)->display_name;	
    	$notify = $parent_id ? get_comment($parent_id)->comment_mail_notify : '0';
    	$spam_confirmed = $comment->comment_approved;
    	
    	if ($parent_id != '' && $spam_confirmed != 'spam' && $notify == '1') {
        $wp_email = 'no-reply@' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME']));
        $author_id = get_comment($parent_id)->user_id;
    		
        if ($post->post_type !== 'works')//How to judge here? ? ?
                    return;
        if ( ! function_exists( 'fep_send_message' ) )
                    return;
            // Prepare message data
            $message = array(
                 'message_title' => 'title', //change with message title
                 'message_content' => 'content', //change with message content
                 'message_to_id' => $author_id
            );
            $override = array(
                 'post_author' => 1, //change with message sender id
            );
            // Send message
           fep_send_message( $message, $override );    
    		
      }
    }	
    add_action( 'comment_post', 'fep_cus_user_reply_comment_message' );
    #10402
    Shamim Hasan
    Keymaster

    What you want to achieve here? You want to send a message to post author when a new comment is posted in his post?

    #10435
    laowei
    Participant

    Thank you very much, I solve this problem.

Viewing 3 posts - 1 through 3 (of 3 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.