Skip to main content
added 108 characters in body
Source Link

I am using the code below on a multi user blog for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this, Please help urgently:

function new_mail_from($old) {
    return '[email protected]';
}
function new_mail_from_name($old) {
     return 'Postmaster - BIZCATALYST360°';
}

/** Notification Upon post Pubished */
function authorNotification( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = get_userdata($post->post_author);
        $message = "
            Hi ".$author->display_name.",
            New post, ".$post->post_title." has just been published at ".get_permalink(      $post->ID ).".
        ";
        wp_mail($author->user_email, "$post->post_title", $message);
    }
}
add_action('transition_post_status', 'authorNotification', 10, 3 );

I am using the code below for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this:

function new_mail_from($old) {
    return '[email protected]';
}
function new_mail_from_name($old) {
     return 'Postmaster - BIZCATALYST360°';
}

/** Notification Upon post Pubished */
function authorNotification( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = get_userdata($post->post_author);
        $message = "
            Hi ".$author->display_name.",
            New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).".
        ";
        wp_mail($author->user_email, "$post->post_title", $message);
    }
}
add_action('transition_post_status', 'authorNotification', 10, 3 );

I am using the code below on a multi user blog for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this, Please help urgently:

function new_mail_from($old) {
 return '[email protected]';
}
function new_mail_from_name($old) {
 return 'Postmaster - BIZCATALYST360°';
}

/** Notification Upon post Pubished */
function authorNotification( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = get_userdata($post->post_author);
        $message = "
            Hi ".$author->display_name.",
            New post, ".$post->post_title." has just been published at ".get_permalink(      $post->ID ).". ";
        wp_mail($author->user_email, "$post->post_title", $message);
    }
}
add_action('transition_post_status', 'authorNotification', 10, 3 );
added 79 characters in body
Source Link
cybmeta
  • 20.6k
  • 5
  • 47
  • 56

I am using the code below for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this:

function new_mail_from($old) { return '[email protected]'; } function new_mail_from_name($old) { return 'Postmaster - BIZCATALYST360°'; }

/** Notification Upon post Pubished */ function authorNotification( $new_status, $old_status, $post ) { if ( $new_status == 'publish' && $old_status != 'publish' ) { $author = get_userdata($post->post_author); $message = " Hi ".$author->display_name.", New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).". "; wp_mail($author->user_email, "$post->post_title", $message); } } add_action('transition_post_status', 'authorNotification', 10, 3 );

function new_mail_from($old) {
    return '[email protected]';
}
function new_mail_from_name($old) {
     return 'Postmaster - BIZCATALYST360°';
}

/** Notification Upon post Pubished */
function authorNotification( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = get_userdata($post->post_author);
        $message = "
            Hi ".$author->display_name.",
            New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).".
        ";
        wp_mail($author->user_email, "$post->post_title", $message);
    }
}
add_action('transition_post_status', 'authorNotification', 10, 3 );

I am using the code below for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this:

function new_mail_from($old) { return '[email protected]'; } function new_mail_from_name($old) { return 'Postmaster - BIZCATALYST360°'; }

/** Notification Upon post Pubished */ function authorNotification( $new_status, $old_status, $post ) { if ( $new_status == 'publish' && $old_status != 'publish' ) { $author = get_userdata($post->post_author); $message = " Hi ".$author->display_name.", New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).". "; wp_mail($author->user_email, "$post->post_title", $message); } } add_action('transition_post_status', 'authorNotification', 10, 3 );

I am using the code below for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this:

function new_mail_from($old) {
    return '[email protected]';
}
function new_mail_from_name($old) {
     return 'Postmaster - BIZCATALYST360°';
}

/** Notification Upon post Pubished */
function authorNotification( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = get_userdata($post->post_author);
        $message = "
            Hi ".$author->display_name.",
            New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).".
        ";
        wp_mail($author->user_email, "$post->post_title", $message);
    }
}
add_action('transition_post_status', 'authorNotification', 10, 3 );
Source Link

How to send post notification when a Author and Contributor post?

I am using the code below for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this:

function new_mail_from($old) { return '[email protected]'; } function new_mail_from_name($old) { return 'Postmaster - BIZCATALYST360°'; }

/** Notification Upon post Pubished */ function authorNotification( $new_status, $old_status, $post ) { if ( $new_status == 'publish' && $old_status != 'publish' ) { $author = get_userdata($post->post_author); $message = " Hi ".$author->display_name.", New post, ".$post->post_title." has just been published at ".get_permalink( $post->ID ).". "; wp_mail($author->user_email, "$post->post_title", $message); } } add_action('transition_post_status', 'authorNotification', 10, 3 );