Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use get_current_user_id() instead of global variable.

  • Loading branch information...
commit 741447c052e82b7e637c3692c4fc2baa38316d77 1 parent 9e53404
@samikeijonen authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 media-filter.php
View
10 media-filter.php
@@ -190,16 +190,14 @@ function media_filter_upload_views_filterable( $views ) {
if ( $media_filter_user_total > 1 ) {
/* Get current user attachment count. @link: http://codex.wordpress.org/Class_Reference/wpdb */
- global $wpdb, $current_user;
- $media_filter_count_mine_attachment = $wpdb->get_var( $wpdb->prepare(
- "
+ global $wpdb;
+ $media_filter_count_mine_attachment = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT(*)
FROM $wpdb->posts
WHERE post_type = 'attachment'
- AND post_author = $current_user->ID
+ AND post_author = %s
AND post_status != 'trash'
- "
- ) );
+ ", get_current_user_id() ) );
$new_views = array(
'media-filter-mine' => sprintf( '<a %s href="%s">%s</a>', $class, esc_url( add_query_arg( 'author', get_current_user_id(), 'upload.php' ) ), sprintf( _n( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $media_filter_count_mine_attachment, 'media-filter' ), number_format_i18n( $media_filter_count_mine_attachment ) ) )
Please sign in to comment.
Something went wrong with that request. Please try again.