+
+ $single = false;
+ if ( !is_array($post_id) ) {
+ $post_id = (array) $post_id;
+ $single = true;
+ }
+ $post_id = array_map('intval', $post_id);
+ $post_id = "'" . implode("', '", $post_id) . "'";
+
+ $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 );
+
+ if ( empty($pending) )
+ return 0;
+
+ if ( $single )
+ return $pending[0][1];
+
+ $pending_keyed = array();
+ foreach ( $pending as $pend )
+ $pending_keyed[$pend[0]] = $pend[1];
+
+ return $pending_keyed;
+}
+
+/**
+ * Add avatars to relevant places in admin, or try to.
+ *
+ * @since unknown
+ * @uses $comment
+ *
+ * @param string $name User name.
+ * @return string Avatar with Admin name.
+ */
+function floated_admin_avatar( $name ) {
+ global $comment;
+
+ $id = $avatar = false;
+ if ( $comment->comment_author_email )
+ $id = $comment->comment_author_email;
+ if ( $comment->user_id )
+ $id = $comment->user_id;
+
+ if ( $id )
+ $avatar = get_avatar( $id, 32 );
+
+ return "$avatar $name";
+}
+
+function enqueue_comment_hotkeys_js() {
+ if ( 'true' == get_user_option( 'comment_shortcuts' ) )
+ wp_enqueue_script( 'jquery-table-hotkeys' );
+}
+
+if ( is_admin() && isset($pagenow) && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
+ if ( get_option('show_avatars') )
+ add_filter( 'comment_author', 'floated_admin_avatar' );