This is the same issue I reported.
UPDATE: I just half-fixed mine myself. I say half-fixed because the error has to do with the amount of ads count, and my fix shows the counts for ALL ads (not just the user), but the user can't see or edit anyone else's ads, they only see the count, so it works for me. I just can't have all the errors for my customers to see.
Unfortunately, I had to change the core file that was reporting the error, but it worked just fine, hopefully not affecting anything else in the site. Maybe this post can help the developer figure out the problem. I don't recommend anyone do so, but this is what I did to make the error disappear:
File edited:
/wp-content/plugins/another-wordpress-classifieds-plugin/includes/admin/class-list-table-restrictions.php
I commented out a few lines of code (line 99 to 105) and returned the variable $counts that was in the conditional code I commented out. So, the 'corrected' full function looks like this
public function filter_posts_count( $counts, $type ) {
global $wpdb;
// COMMENT OUT FROM HERE
/* if ( $this->roles_and_capabilities->current_user_is_moderator() ) {
return $counts;
}
if ( $this->listing_post_type !== $type ) {
return $counts;
}*/
// COMMENT OUT TO HERE
return $counts; // ADD THIS
$counts = array_fill_keys( array_keys( $counts ), 0 );
$current_user_id = $this->request->get_current_user_id();
$cache_key = "posts-{$this->listing_post_type}_{$current_user_id}";
$results = wp_cache_get( $cache_key, 'awpcp-counts' );
if ( ! is_array( $results ) ) {
$query = $wpdb->prepare(
"
SELECT post_status, COUNT( * ) AS num_posts
FROM {$wpdb->posts}
WHERE post_type = %s AND post_author = %d GROUP BY post_status
",
$type,
$current_user_id
);
$results = $wpdb->get_results( $query, ARRAY_A );
// This function is called on the Classifieds Ads admin page only.
// This cache should prevent the query from being executed twice or
// more on a single request, but we don't want to store the results
// between requests to avoid having to add extra logic to invalidate
// the cache.
wp_cache_set( $cache_key, $results, 'awpcp-counts', 30 );
}
foreach ( $results as $row ) {
$counts->{$row['post_status']} = $row['num_posts'];
}
return $counts;
}