Make WordPress Core


Ignore:
Timestamp:
10/19/2007 06:39:07 PM (18 years ago)
Author:
ryan
Message:

AJAX list manipulation fixes for single post comment moderation. Props mdawaffe. fixes #5236

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r6213 r6277  
    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'>";
     142        $i = 0;
     143        foreach ( $comments as $comment ) {
     144            _wp_comment_list_item( $comment->comment_ID, ++$i );
     145        }
     146    echo '</ol>';
     147    } // end if comments
    151148?>
    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
    173     echo '</ol>';
    174     }//end if comments
    175     ?>
    176149<?php } ?>
    177150</div>
Note: See TracChangeset for help on using the changeset viewer.