From b27053bf5a69b63df2dfdefbb7d0d634a8146af8 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 11 Mar 2008 21:09:07 +0000 Subject: [PATCH] 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 --- wp-admin/edit-attachment-rows.php | 16 ++++++++ wp-admin/includes/template.php | 9 ++++- wp-admin/upload.php | 65 ++++++++++++++++++++----------- 3 files changed, 66 insertions(+), 24 deletions(-) diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php index 09ff82129..a7eb91db0 100644 --- a/wp-admin/edit-attachment-rows.php +++ b/wp-admin/edit-attachment-rows.php @@ -93,6 +93,22 @@ foreach($posts_columns as $column_name=>$column_display_name) { + + ID ); + $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); + if ( $left ) + echo ''; + comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); + if ( $left ) + echo ''; + ?> + + diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 8959ac23b..da034e300 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -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'] = '
Comments
'; $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 = '' . get_the_title($comment->comment_post_ID) . ''; + if ( 'attachment' == $post->post_type ) + $post_link = ""; + elseif ( 'page' == $post->post_type ) + $post_link = ""; + else + $post_link = ""; + $post_link .= get_the_title($comment->comment_post_ID) . ''; $author_url = get_comment_author_url(); if ( 'http://' == $author_url ) $author_url = ''; diff --git a/wp-admin/upload.php b/wp-admin/upload.php index a4495a011..1f248ac4d 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -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'] ) )

post_title)); } else { $post_mime_type_label = _c('Manage Media|manage media header'); @@ -140,13 +141,14 @@ if ( $page_links ) 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 ) ) : ?> - + + +
@@ -193,27 +197,42 @@ if ( $page_links ) 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); ?> -

-
    + +
    + + + + + + + + + +comment_ID, ++$i ); - } - echo ''; - } // end if comments + foreach ($comments as $comment) + _wp_comment_row( $comment->comment_ID, 'detail', false, false ); ?> - + +
    + + +