Make WordPress Core

Ticket #30091: 30091.diff

File 30091.diff, 1.7 KB (added by voldemortensen, 11 years ago)
  • src/wp-comments-post.php

     
    5858         */
    5959        do_action( 'comment_on_trash', $comment_post_ID );
    6060        exit;
    61 } elseif ( ! $status_obj->public && ! $status_obj->private ) {
    62         /**
    63          * Fires when a comment is attempted on a post in draft mode.
    64          *
    65          * @since 1.5.1
    66          *
    67          * @param int $comment_post_ID Post ID.
    68          */
    69         do_action( 'comment_on_draft', $comment_post_ID );
    70         exit;
    7161} elseif ( post_password_required( $comment_post_ID ) ) {
    7262        /**
    7363         * Fires when a comment is attempted on a password-protected post.
     
    7969        do_action( 'comment_on_password_protected', $comment_post_ID );
    8070        exit;
    8171} else {
    82         /**
    83          * Fires before a comment is posted.
    84          *
    85          * @since 2.8.0
    86          *
    87          * @param int $comment_post_ID Post ID.
    88          */
    89         do_action( 'pre_comment_on_post', $comment_post_ID );
     72        if ( ! $status_obj->public && ! $status_obj->private && current_user_can( 'edit_posts') ) {
     73
     74                /**
     75                 * Fires when a comment is attempted on a post in draft mode.
     76                 *
     77                 * @since 1.5.1
     78                 *
     79                 * @param int $comment_post_ID Post ID.
     80                 */
     81                do_action( 'comment_on_draft', $comment_post_ID );
     82
     83                /**
     84                 * Fires before a comment is posted.
     85                 *
     86                 * @since 2.8.0
     87                 *
     88                 * @param int $comment_post_ID Post ID.
     89                 */
     90                do_action( 'pre_comment_on_post', $comment_post_ID );
     91        } else {
     92                do_action( 'pre_comment_on_post', $comment_post_ID );
     93        }
    9094}
    9195
    9296$comment_author       = ( isset($_POST['author']) )  ? trim(strip_tags($_POST['author'])) : null;