Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘Popularity Contest says “No posts found”’ is closed to new replies.