WordPress.org

Make WordPress Core

Changeset 7251


Ignore:
Timestamp:
03/11/2008 09:09:07 PM (14 years ago)
Author:
ryan
Message:

Fix comment bubble links for attachments and pages. Props mdawaffe. fixes #6169

Location:
trunk/wp-admin
Files:
3 edited

Legend:

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

    r7218 r7251  
    9494        break;
    9595
     96    case 'comments':
     97        ?>
     98        <td style="text-align: center">
     99        <?php
     100        $left = get_pending_comments_num( $post->ID );
     101        $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
     102        if ( $left )
     103            echo '<strong>';
     104        comments_number("<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
     105        if ( $left )
     106            echo '</strong>';
     107        ?>
     108        </td>
     109        <?php
     110        break;
     111
    96112    case 'location':
    97113        ?>
  • trunk/wp-admin/includes/template.php

    r7231 r7251  
    305305    $posts_columns['date'] = _c('Date Added|media column header');
    306306    $posts_columns['parent'] = _c('Appears with|media column header');
     307    $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
    307308    $posts_columns['location'] = _c('Location|media column header');
    308309    $posts_columns = apply_filters('manage_media_columns', $posts_columns);
     
    600601    $the_comment_status = wp_get_comment_status($comment->comment_ID);
    601602    $class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
    602     $post_link = '<a href="edit.php?p=' . $comment->comment_post_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>';
     603    if ( 'attachment' == $post->post_type )
     604        $post_link = "<a href='upload.php?attachment_id=$post->ID'>";
     605    elseif ( 'page' == $post->post_type )
     606        $post_link = "<a href='edit-pages.php?page_id=$post->ID'>";
     607    else
     608        $post_link = "<a href='edit.php?p=$post->ID'>";
     609    $post_link .= get_the_title($comment->comment_post_ID) . '</a>';
    603610    $author_url = get_comment_author_url();
    604611    if ( 'http://' == $author_url )
  • trunk/wp-admin/upload.php

    r7184 r7251  
    3333$parent_file = 'edit.php';
    3434wp_enqueue_script( 'admin-forms' );
    35 if ( 1 == $_GET['c'] )
    36     wp_enqueue_script( 'admin-comments' );
    37 
    38 require_once('admin-header.php');
    3935
    4036if ( isset($_GET['paged']) && $start = ( intval($_GET['paged']) - 1 ) * 15 )
     
    4339$wp_query->max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra )
    4440
     41if ( is_singular() )
     42    wp_enqueue_script( 'admin-comments' );
     43
     44require_once('admin-header.php');
     45
    4546if ( !isset( $_GET['paged'] ) )
    4647    $_GET['paged'] = 1;
     
    5253<form id="posts-filter" action="" method="get">
    5354<h2><?php
    54 if ( is_single() ) {
     55if ( is_singular() ) {
    5556    printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
    5657} else {
     
    141142<?php
    142143
    143 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
    144 
    145 $arc_result = $wpdb->get_results( $arc_query );
    146 
    147 $month_count = count($arc_result);
    148 
    149 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
     144if ( !is_singular() ) :
     145    $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
     146
     147    $arc_result = $wpdb->get_results( $arc_query );
     148
     149    $month_count = count($arc_result);
     150
     151    if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
    150152<select name='m'>
    151153<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
     
    167169?>
    168170</select>
    169 <?php } ?>
     171<?php endif; // month_count ?>
    170172
    171173<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
     174
     175<?php endif; // is_singular ?>
    172176
    173177</div>
     
    194198
    195199<?php
    196 
    197 if ( 1 == count($posts) && isset( $_GET['p'] ) ) {
    198 
     200 
     201if ( 1 == count($posts) && is_singular() ) :
     202   
    199203    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
    200     if ($comments) {
     204    if ( $comments ) :
    201205        // Make sure comments, post, and post_author are cached
    202206        update_comment_cache($comments);
     
    204208        $authordata = get_userdata($post->post_author);
    205209    ?>
    206 <h3 id="comments"><?php _e('Comments') ?></h3>
    207 <ol id="the-comment-list" class="list:comment commentlist">
    208 <?php
    209         $i = 0;
    210         foreach ( $comments as $comment ) {
    211             _wp_comment_list_item( $comment->comment_ID, ++$i );
    212         }
    213     echo '</ol>';
    214     } // end if comments
    215 ?>
    216 <?php } ?>
     210
     211<br class="clear" />
     212
     213<table class="widefat" style="margin-top: .5em">
     214<thead>
     215  <tr>
     216    <th scope="col"><?php _e('Comment') ?></th>
     217    <th scope="col"><?php _e('Date') ?></th>
     218    <th scope="col"><?php _e('Actions') ?></th>
     219  </tr>
     220</thead>
     221<tbody id="the-comment-list" class="list:comment">
     222<?php
     223        foreach ($comments as $comment)
     224                _wp_comment_row( $comment->comment_ID, 'detail', false, false );
     225?>
     226</tbody>
     227</table>
     228
     229<?php
     230
     231endif; // comments
     232endif; // posts;
     233
     234?>
     235
    217236</div>
    218237
Note: See TracChangeset for help on using the changeset viewer.