Support » Plugins » Popularity Contest Plugin and WordPress, 2.1

  • I am using the Popularity Contest Plugin by Alex King and wordpress, 2.1. Upon saving a post, i get the following error.

    Warning: Invalid argument supplied for foreach() in wp-content/plugins/popularity-contest.php on line 1295 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 ‘)’ at line 3

Viewing 15 replies - 1 through 15 (of 23 total)
  • I hope to have time to find out what needs fixing for 2.x and get it fixed soon.

    I just got latest WP out of SVN and I can’t seem to reproduce this problem. Additionally, looking at the code in that area in Popularity Contest, I can’t see how an error condition could occur to generate that warning.

    Are you using version 1.1 of Popularity Contest?

    Yes, the latest version available (1.1) from your site. I have tried your version and this version and both returns the same error.

    If you have other plugins installed, have you tried disabling them and seeing if the error persists?

    I’m willing to take a look at this on your server – e-mail me your FTP/SFTP login and a login to your WP install if you want me to take a look.

    Alex, not to hijack this thread, but Popularity Content isn’t recording visits on WordPress 2.0.x. I’m not getting any errors, it’s just not recording anything. I just wanted to make you aware of this issue.

    Very interesting.

    I just got latest from WP SVN and Popularity Contest SVN on I ran upgrade.php on my existing database – hit the site a few times – everything worked perfectly.

    Then I dropped the database and did a clean install in a new database. For some reason, now that there is a clean install, my ‘is_admin_page’ function (which checks for the existance of the ‘check_admin_referer’ function) now returns true, causing the plugin not to record any views.

    The is_admin function (added in 2.x I believe) seems to accomplish the same goal as my ‘is_admin_page’ function, so I’ve added a patch to use that if it’s available.

    What I really don’t understand though, it how the database change (upgraded DB vs. clean 2.x DB) made any difference. Also, why ‘check_admin_referer’ is active on non-admin pages now is beyond me.

    Anyway – new version checked in to

    Alex, I just grabbed the latest version. I’ll let you know if its start recording hits.

    Now just to make things even more interesting for you, I have an upgraded DB. I’ve used the same database since WordPress 1.2x, so your theory of a clean install doesn’t hold up.

    The only thing I can possibly think of is ‘check_admin_referer’ now reports if the post is created by an admin. The reason why I say that is because I have some older pages that I imported from MT before I used WordPress. Those posts were not imported as the admin user; I had to create a new user to import them. Those pages were tracking hits, leading me to believe that the ‘check_admin_referer’ is now reporting if the admin created the page.

    heh. the shortstat plugin and popularity plugin i was using ran into problems, and i discovered it’s the same reason. and same solution. so i’ll just copy and paste from the other thread

    Okay, I fixed the wp-shortstat problem. Here’s the deal: in order to avoid recording admin page hits, the plugin was testing whether or not a function named “check_admin_referer” was defined. That worked until WP 2.0.1, when that function moved from the admin functions to pluggable functions, meaning it’s now always defined.

    so swap
    if (function_exists(‘check_admin_referer’)) {
    if (function_exists(‘user_can_access_admin_page’)) {

    I applied the latest version from trunk and it seems to be working fine now!

    I found the latest version of the plugin on the WP Plugins Site, and it seems to be working for me. Yay!

    Hmmm I am running 2.01 and donot have the <?php akpc_the_popularity(); ? in my loop but each post is showing a popularity.

    I don’t want to show popularity on my pages, How do I remove this from my pages.


    elyonline, there is a variable you need to change to a 0 in the very beginning of the file to prevent the popularity information being shown.

    Alex, after giving it some time, I can confirm that the latest update is indeed logging hits.

    Ah yes that was it, forgot after I downloaded latest version. Thanks

    another side track. is it possible to hack this such that popularity of pages are counted too??

    I run a blog with extensive pages….. so it’ll be nice if someone could tell me how to change things

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Popularity Contest Plugin and WordPress, 2.1’ is closed to new replies.