Forums

Popularity Contest says "No posts found" (2 posts)

  1. godrox
    Member
    Posted 1 year ago #

    Popularity Contest was running fine for a while and then I randomly noticed that it was just showing "(none)" in my sidebar. I tried resetting the stats, but got a php fatal error, which I fixed by following the instructions in the comments here:

    http://alexking.org/blog/2009/06/25/popularity-contest-20-beta-2

    But my Most Popular Posts Report in the admin area of WP still shows "No Posts Found" and it still displays "(none)" in my sidebar. I have no idea what is causing this. Any help?

    http://wordpress.org/extend/plugins/popularity-contest/

  2. rfvgyhn
    Member
    Posted 1 year ago #

    I am having the same issue. I wrote my own widget that uses $akpc->get_popular_posts(). I now receive this error:

    Notice: Undefined index: column in /var/www/getpackin/wp-content/plugins/popularity-contest/popularity-contest.php on line 1186 Notice: Undefined index: column in /var/www/getpackin/wp-content/plugins/popularity-contest/popularity-contest.php on line 1186 Notice: Undefined index: column in /var/www/getpackin/wp-content/plugins/popularity-contest/popularity-contest.php on line 1194
    
    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS FROM wp_posts p LEFT JOIN wp_ak_popularity pop ON p.ID = pop.' at line 1]
    SELECT p.ID AS ID, p.post_title AS post_title, pop. AS FROM wp_posts p LEFT JOIN wp_ak_popularity pop ON p.ID = pop.post_id WHERE p.post_status = 'publish' AND p.post_type != 'page' ORDER BY pop. DESC LIMIT 50

    Looks like because I don't pass in any custom options (4th parameter $custom = array()), the query breaks. pop.{$custom['column']} is the problem.

    My fix was to modify function get_popular_posts to check if the array key existed first and only if it did, add it into the query.

Topic Closed

This topic has been closed to new replies.

About this Topic