Fix comment bubble links for attachments and pages. Props mdawaffe. fixes #6169
git-svn-id: http://svn.automattic.com/wordpress/trunk@7251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
674e725d06
commit
b27053bf5a
|
@ -93,6 +93,22 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||
<?php
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
?>
|
||||
<td style="text-align: center">
|
||||
<?php
|
||||
$left = get_pending_comments_num( $post->ID );
|
||||
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
|
||||
if ( $left )
|
||||
echo '<strong>';
|
||||
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>');
|
||||
if ( $left )
|
||||
echo '</strong>';
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'location':
|
||||
?>
|
||||
<td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td>
|
||||
|
|
|
@ -304,6 +304,7 @@ function wp_manage_media_columns() {
|
|||
$posts_columns['desc'] = _c('Description|media column header');
|
||||
$posts_columns['date'] = _c('Date Added|media column header');
|
||||
$posts_columns['parent'] = _c('Appears with|media column header');
|
||||
$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
|
||||
$posts_columns['location'] = _c('Location|media column header');
|
||||
$posts_columns = apply_filters('manage_media_columns', $posts_columns);
|
||||
|
||||
|
@ -599,7 +600,13 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
|||
$authordata = get_userdata($post->post_author);
|
||||
$the_comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
$class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
|
||||
$post_link = '<a href="edit.php?p=' . $comment->comment_post_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>';
|
||||
if ( 'attachment' == $post->post_type )
|
||||
$post_link = "<a href='upload.php?attachment_id=$post->ID'>";
|
||||
elseif ( 'page' == $post->post_type )
|
||||
$post_link = "<a href='edit-pages.php?page_id=$post->ID'>";
|
||||
else
|
||||
$post_link = "<a href='edit.php?p=$post->ID'>";
|
||||
$post_link .= get_the_title($comment->comment_post_ID) . '</a>';
|
||||
$author_url = get_comment_author_url();
|
||||
if ( 'http://' == $author_url )
|
||||
$author_url = '';
|
||||
|
|
|
@ -32,16 +32,17 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
|||
$title = __('Media Library');
|
||||
$parent_file = 'edit.php';
|
||||
wp_enqueue_script( 'admin-forms' );
|
||||
if ( 1 == $_GET['c'] )
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
|
||||
require_once('admin-header.php');
|
||||
|
||||
if ( isset($_GET['paged']) && $start = ( intval($_GET['paged']) - 1 ) * 15 )
|
||||
add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 15';" ) );
|
||||
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
|
||||
$wp_query->max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra )
|
||||
|
||||
if ( is_singular() )
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
|
||||
require_once('admin-header.php');
|
||||
|
||||
if ( !isset( $_GET['paged'] ) )
|
||||
$_GET['paged'] = 1;
|
||||
|
||||
|
@ -51,7 +52,7 @@ if ( !isset( $_GET['paged'] ) )
|
|||
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<h2><?php
|
||||
if ( is_single() ) {
|
||||
if ( is_singular() ) {
|
||||
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
|
||||
} else {
|
||||
$post_mime_type_label = _c('Manage Media|manage media header');
|
||||
|
@ -140,13 +141,14 @@ if ( $page_links )
|
|||
<?php wp_nonce_field('bulk-media'); ?>
|
||||
<?php
|
||||
|
||||
$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";
|
||||
if ( !is_singular() ) :
|
||||
$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";
|
||||
|
||||
$arc_result = $wpdb->get_results( $arc_query );
|
||||
$arc_result = $wpdb->get_results( $arc_query );
|
||||
|
||||
$month_count = count($arc_result);
|
||||
$month_count = count($arc_result);
|
||||
|
||||
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
|
||||
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
|
||||
<select name='m'>
|
||||
<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
|
||||
<?php
|
||||
|
@ -166,10 +168,12 @@ foreach ($arc_result as $arc_row) {
|
|||
}
|
||||
?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
<?php endif; // month_count ?>
|
||||
|
||||
<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
|
||||
|
||||
<?php endif; // is_singular ?>
|
||||
|
||||
</div>
|
||||
|
||||
<br style="clear:both;" />
|
||||
|
@ -193,27 +197,42 @@ if ( $page_links )
|
|||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if ( 1 == count($posts) && isset( $_GET['p'] ) ) {
|
||||
|
||||
|
||||
if ( 1 == count($posts) && is_singular() ) :
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
if ( $comments ) :
|
||||
// Make sure comments, post, and post_author are cached
|
||||
update_comment_cache($comments);
|
||||
$post = get_post($id);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="list:comment commentlist">
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<table class="widefat" style="margin-top: .5em">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('Comment') ?></th>
|
||||
<th scope="col"><?php _e('Date') ?></th>
|
||||
<th scope="col"><?php _e('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $comments as $comment ) {
|
||||
_wp_comment_list_item( $comment->comment_ID, ++$i );
|
||||
}
|
||||
echo '</ol>';
|
||||
} // end if comments
|
||||
foreach ($comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, 'detail', false, false );
|
||||
?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
endif; // comments
|
||||
endif; // posts;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
|
Loading…
Reference in New Issue