WordPress.org

Make WordPress Core

Ticket #5236: 5236.diff

File 5236.diff, 5.4 KB (added by mdawaffe, 11 years ago)
  • wp-admin/edit-comments.php

     
    105105                echo "<ol id='the-comment-list' class='list:comment commentlist' $start>\n";
    106106                $i = 0;
    107107                foreach ( $comments as $comment ) {
    108                         get_comment( $comment ); // Cache it
    109108                        _wp_comment_list_item( $comment->comment_ID, ++$i );
    110109                }
    111110                echo "</ol>\n\n";
  • wp-admin/includes/template.php

     
    318318        $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) );
    319319        echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> ';
    320320}
    321 $post = get_post($comment->comment_post_ID, OBJECT, 'display');
    322 $post_title = wp_specialchars( $post->post_title, 'double' );
    323 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
     321if ( !is_single() ) {
     322        $post = get_post($comment->comment_post_ID, OBJECT, 'display');
     323        $post_title = wp_specialchars( $post->post_title, 'double' );
     324        $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
    324325?>
    325  ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
     326 ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a>
     327<?php } ?>
     328</p>
    326329                </li>
    327330<?php
    328331}
  • wp-admin/edit.php

     
    131131
    132132        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
    133133        if ($comments) {
     134                // Make sure comments, post, and post_author are cached
    134135                update_comment_cache($comments);
     136                $post = get_post($id);
     137                $authordata = get_userdata($post->post_author);
    135138        ?>
    136139<h3 id="comments"><?php _e('Comments') ?></h3>
    137 <ol id="the-comment-list" class="commentlist">
     140<ol id="the-comment-list" class="list:comment commentlist">
    138141<?php
    139 $i = 0;
    140 foreach ($comments as $comment) {
    141 
    142                 ++$i; $class = '';
    143                 $post = get_post($comment->comment_post_ID);
    144                 $authordata = get_userdata($post->post_author);
    145                         $comment_status = wp_get_comment_status($comment->comment_ID);
    146                         if ('unapproved' == $comment_status)
    147                                 $class .= ' unapproved';
    148                         if ($i % 2)
    149                                 $class .= ' alternate';
    150                         echo "<li id='comment-$comment->comment_ID' class='$class'>";
    151 ?>
    152 <p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=edit"><?php comment_author_IP() ?></a></p>
    153 
    154 <?php comment_text() ?>
    155 
    156 <p><?php comment_date(__('M j, g:i A')); ?> &#8212; [
    157 <?php
    158 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    159         echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
    160         echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    161         if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    162                 echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
    163                 echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    164         }
    165         echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
    166 }
    167 ?> ]
    168 </p>
    169                 </li>
    170 
    171 <?php //end of the loop, don't delete
    172                 } // end foreach
     142                $i = 0;
     143                foreach ( $comments as $comment ) {
     144                        _wp_comment_list_item( $comment->comment_ID, ++$i );
     145                }
    173146        echo '</ol>';
    174         }//end if comments
    175         ?>
     147        } // end if comments
     148?>
    176149<?php } ?>
    177150</div>
    178151