Changeset 12715 for trunk/wp-admin
- Timestamp:
- 01/12/2010 10:38:26 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r12616 r12715 245 245 $_comment_post_ids[] = $_c->comment_post_ID; 246 246 } 247 $_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids); 248 foreach ( (array) $_comment_post_ids as $_cpid ) 249 $_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0; 250 if ( empty($_comment_pending_count) ) 251 $_comment_pending_count = array(); 247 248 $_comment_pending_count = get_pending_comments_num($_comment_post_ids); 252 249 253 250 $comments = array_slice($_comments, 0, $comments_per_page); -
trunk/wp-admin/includes/comment.php
r12595 r12715 110 110 $single = false; 111 111 if ( !is_array($post_id) ) { 112 $post_id = (array) $post_id;112 $post_id_array = (array) $post_id; 113 113 $single = true; 114 } else { 115 $post_id_array = $post_id; 114 116 } 115 $post_id = array_map('intval', $post_id);116 $post_id = "'" . implode("', '", $post_id) . "'";117 $post_id_array = array_map('intval', $post_id_array); 118 $post_id_in = "'" . implode("', '", $post_id_array) . "'"; 117 119 118 $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_N);120 $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); 119 121 120 if ( empty($pending) ) 121 return 0; 122 if ( $single ) { 123 if ( empty($pending) ) 124 return 0; 125 else 126 return absint($pending[0]['num_comments']); 127 } 128 129 $pending_keyed = array(); 130 131 // Default to zero pending for all posts in request 132 foreach ( $post_id_array as $id ) 133 $pending_keyed[$id] = 0; 122 134 123 if ( $single ) 124 return $pending[0][1]; 125 126 $pending_keyed = array(); 127 foreach ( $pending as $pend ) 128 $pending_keyed[$pend[0]] = $pend[1]; 135 if ( !empty($pending) ) 136 foreach ( $pending as $pend ) 137 $pending_keyed[$pend['comment_post_ID']] = absint($pend['num_comments']); 129 138 130 139 return $pending_keyed; -
trunk/wp-admin/includes/template.php
r12702 r12715 2264 2264 if ( 'single' !== $mode ) { 2265 2265 if ( isset( $_comment_pending_count[$post->ID] ) ) { 2266 $pending_comments = absint( $_comment_pending_count[$post->ID] );2266 $pending_comments = $_comment_pending_count[$post->ID]; 2267 2267 } else { 2268 2268 $_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); 2269 $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp ;2269 $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID]; 2270 2270 } 2271 2271 if ( $user_can ) {
Note: See TracChangeset
for help on using the changeset viewer.