Make WordPress Core

Changeset 27568


Ignore:
Timestamp:
03/17/2014 08:30:04 PM (10 years ago)
Author:
nacin
Message:

Avoid notices in wp_notify_postauthor() when a post has no author.

props drozdz.
fixes #26659.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r27567 r27568  
    10331033
    10341034    // Who to notify? By default, just the post author, but others can be added.
    1035     $emails = array( $author->user_email );
     1035    $emails = array();
     1036    if ( $author ) {
     1037        $emails[] = $author->user_email;
     1038    }
    10361039
    10371040    /**
     
    10711074
    10721075    // The comment was left by the author
    1073     if ( ! $notify_author && $comment->user_id == $post->post_author ) {
     1076    if ( $author && ! $notify_author && $comment->user_id == $post->post_author ) {
    10741077        unset( $emails[ $author->user_email ] );
    10751078    }
    10761079
    10771080    // The author moderated a comment on their own post
    1078     if ( ! $notify_author && $post->post_author == get_current_user_id() ) {
     1081    if ( $author && ! $notify_author && $post->post_author == get_current_user_id() ) {
    10791082        unset( $emails[ $author->user_email ] );
    10801083    }
    10811084
    10821085    // The post author is no longer a member of the blog
    1083     if ( ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
     1086    if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
    10841087        unset( $emails[ $author->user_email ] );
    10851088    }
Note: See TracChangeset for help on using the changeset viewer.