Support » Plugin: IdeaPush » Author notificaiton when idea has a new comment

  • Resolved kaizerco

    (@kaizerco)


    Is it possible to get an email notification to the author when an idea has a new comment? (and to the admin too)

    • This topic was modified 10 months, 2 weeks ago by kaizerco.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @kaizerco,

    The comments part has nothing to do with IdeaPush as IdeaPush uses the standard WordPress comments – we don’t muck around with this in anyway. So what you are asking is a general WordPress question. However I know you are a pro user and this isn’t a biggie so I am going to provide a snippet below which you can put in your themes functions.php file.

    add_action( ‘comment_post’, ‘show_message_function’, 10, 2 );
    function show_message_function( $comment_ID, $comment_approved ) {
    //wrap the code in the following container if you only want to send the email if the comment is approved
    // if( 1 === $comment_approved ){
    // //function logic goes here
    // }
    $comment_id = get_comment( $comment_ID );
    $comment_post_id = $comment_id->comment_post_ID;
    $get_post_type_from_id = get_post_type( $comment_post_id );

    //only proceed if the post type is an idea
    if($get_post_type_from_id == ‘idea’){

    $emails_to_send_to = array();
    //add the admin email to recipients
    $options = get_option(‘idea_push_settings’);
    $admin_email = $options[‘idea_push_notification_email’];
    array_push($emails_to_send_to,$admin_email);

    //add the idea author
    $post_author_id = get_post_field( ‘post_author’, $comment_post_id );
    $post_author = get_user_by(‘id’,$post_author_id);
    $post_author_email = $post_author->user_email;
    array_push($emails_to_send_to,$post_author_email);

    foreach($emails_to_send_to as $notification){
    //put your subject here
    $subject = ‘A new comment was made on idea: ‘.$comment_post_id;
    //put your email content here:
    $body = ‘A new comment was made on idea: ‘.$comment_post_id;
    //send the email
    idea_push_send_email($notification,$subject,$body);
    }
    }

    }

    You may want to customise this code as per the comments.

    Also as you are a pro customer I do recommend emailing us directly for support as that way I will be able to assist you faster. Thanks

    Thank you so much Sir!

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    No worries 🙂

    Hi there,

    I’ve had a ‘live’ idea comment published, and I then went to check how the notification emails were being sent out to the idea author (and to me the admin), and surprisingly I found that 2 notification emails were being sent out to the comment author! One from the script you kindly published here, and the second was coming from WordPress!? Apparently WordPress sends post authors emails by default(!?), with the post url and everything. So I figured I’d let you know that apparently there is no need for your additional script…

    Searching google about comment notifications brings up pointers to go to Settings > Discussion, but the various options there say nothing about comment notifications to other post authors, or other WordPress users. There are also a bunch of plugins that come up that are supposed to do this, even though there is no need apparently! (I don’t have any notificaiton plugins installed).

    It seems like this feature is there and works, but it is really poorly documented by WordPress, unless I’m missing something.

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @kaizerco,

    Good to know. Thanks,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author notificaiton when idea has a new comment’ is closed to new replies.