WordPress.org

Make WordPress Core

Ticket #3830: edit.php.diff

File edit.php.diff, 4.4 KB (added by Martin10, 7 years ago)

Support comment-list.php

  • wp-admin/edit.php

     
    55$parent_file = 'edit.php'; 
    66wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' ); 
    77require_once('admin-header.php'); 
     8require_once('comment-list.php'); 
    89 
    910$_GET['m'] = (int) $_GET['m']; 
    1011 
     
    256257 
    257258<?php 
    258259if ( 1 == count($posts) ) { 
    259  
    260         $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); 
    261         if ($comments) { 
    262         ?> 
    263 <h3 id="comments"><?php _e('Comments') ?></h3> 
    264 <ol id="the-comment-list" class="commentlist"> 
    265 <?php 
    266 $i = 0; 
    267 foreach ($comments as $comment) { 
    268  
    269                 ++$i; $class = ''; 
    270                 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 
    271                         $comment_status = wp_get_comment_status($comment->comment_ID); 
    272                         if ('unapproved' == $comment_status) 
    273                                 $class .= ' unapproved'; 
    274                         if ($i % 2) 
    275                                 $class .= ' alternate'; 
    276                         echo "<li id='comment-$comment->comment_ID' class='$class'>"; 
    277 ?> 
    278 <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="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 
    279  
    280 <?php comment_text() ?> 
    281  
    282 <p><?php comment_date(__('M j, g:i A'));  ?> &#8212; [ 
    283 <?php 
    284 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    285         echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>'; 
    286         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> '; 
    287         if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 
    288                 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>'; 
    289                 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>'; 
     260        if ( isset( $_GET['apage'] ) ) { 
     261                $page = (int) $_GET['apage']; 
     262        } else { 
     263                $page = 1; 
    290264        } 
    291         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> "; 
    292 } 
     265        $start = $offset = ( $page - 1 ) * 20; 
    293266?> 
     267<p><a href="<?php echo "edit.php?p=$id&amp;c=1&mode=view";?>"><?php _e('View Mode') ?></a> | <a 
     268        href="<?php echo "edit.php?p=$id&amp;c=1&mode=edit";?>"><?php _e('Mass Edit Mode') ?></a> 
    294269</p> 
    295                 </li> 
    296  
    297 <?php //end of the loop, don't delete 
    298                 } // end foreach 
    299         echo '</ol>'; 
    300         }//end if comments 
    301         ?> 
    302 <?php } ?> 
     270<?php 
     271        process_delete_comments(); 
     272        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date LIMIT $start, 20"); 
     273        $total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam'"); 
     274        show_comment_list($comments, $mode, $total, $page); 
     275} ?> 
    303276</div> 
    304277<?php 
    305  include('admin-footer.php'); 
     278include('admin-footer.php'); 
    306279?>