WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Popularity Contest Plugin (beta) (58 posts)

  1. Alex King
    Member
    Posted 9 years ago #

    The details: http://www.alexking.org/blog/2005/05/23/popularity-contest/

    Please post bug reports and support questions here.

  2. normgregory
    Member
    Posted 9 years ago #

    At the bottom of the Most Popular Posts page I got this error message:

    Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/normgregory.com/subdomains/blog/httpdocs/wp-content/plugins/popularity-contest.php on line 941

  3. XeroCool
    Member
    Posted 9 years ago #

    Same here.

    I get 2:

    Warning: Invalid argument supplied for foreach() in /usr/home/xerocool/domains/r0x0rz.info/public_html/wp-content/plugins/popularity-contest.php on line 710

    and:
    /usr/home/xerocool/domains/r0x0rz.info/public_html/wp-content/plugins/popularity-contest.php on line 710

    and:
    /usr/home/xerocool/domains/r0x0rz.info/public_html/wp-content/plugins/popularity-contest.php on line 940

    I meant 3 ;).

  4. Alex King
    Member
    Posted 9 years ago #

    Thanks, easy fix for next release. Looks like you have some categories without posts.

  5. Arlo
    Member
    Posted 9 years ago #

    How do I turn off showing the % in all the posts? I would only want to use it in the sidebar.

    edit: nevermind..it helps to read the source :)

  6. Alex King
    Member
    Posted 9 years ago #

    From the README.txt:

    ...read the installation instructions at the top of the plugin to disable showing popularity for each post.

  7. Arlo
    Member
    Posted 9 years ago #

    I got these errors in the report page:

    WordPress database error: [Got error 12 from storage engine]
    SELECT DISTINCT c.cat_name AS cat_name, AVG(pop.total) AS avg FROM wp_posts p LEFT JOIN wp_ak_popularity pop ON p.ID = pop.post_id LEFT JOIN wp_post2cat pc ON p.ID = pc.post_id LEFT JOIN wp_categories c ON pc.category_id = c.cat_ID GROUP BY c.cat_ID ORDER BY avg DESC

    Warning: Invalid argument supplied for foreach() in /www/a/automatorwor/htdocs/wordpress/wp-content/plugins/popularity-contest.php on line 754
    WordPress database error: [Got error 12 from storage engine]
    SELECT MONTH(p.post_date) AS month, AVG(pop.total) AS avg FROM wp_posts p LEFT JOIN wp_ak_popularity pop ON p.ID = pop.post_id WHERE YEAR(p.post_date) = '2005' GROUP BY month ORDER BY avg DESC

    Warning: Invalid argument supplied for foreach() in /www/a/automatorwor/htdocs/wordpress/wp-content/plugins/popularity-contest.php on line 774
    WordPress database error: [Got error 12 from storage engine]
    SELECT MONTH(p.post_date) AS month, AVG(pop.total) AS avg FROM wp_posts p LEFT JOIN wp_ak_popularity pop ON p.ID = pop.post_id WHERE YEAR(p.post_date) = '2004' GROUP BY month ORDER BY avg DESC

    Warning: Invalid argument supplied for foreach() in /www/a/automatorwor/htdocs/wordpress/wp-content/plugins/popularity-contest.php on line 774

  8. Alex King
    Member
    Posted 9 years ago #

    Interesting - can you run that top SQL query on the database directly and let me know what the error from MySQL is?

  9. Arlo
    Member
    Posted 9 years ago #

    weird-- I restarted the plugin and they're gone now (I am still getting the two errors already described above).

    This is working well for me now-- quesiton: I'm using it in my sidebar like this, which gives me a nice "top 10" ordered list of posts in category 1. :
    <ol><php akpc_most_popular_in_cat(10,'<li>','</li>',1); ?></ol>

    I have a number of subcategories under a top-level category that doesn't have the posts explicitly attached to them--as a way method to have an "invisible" category. Is there a way to use the top level cat and have all the sub-cats show in the list? Short of this, could there be a way to include multiple categories?

  10. Alex King
    Member
    Posted 9 years ago #

    The example code included in sidebar.php makes it easy to make the list 'category aware' for a single category. However, there is no concept of showing multiple categories in the current code.

    Feel free to add/edit as you like - it shouldn't be hard to modify.

  11. Arlo
    Member
    Posted 9 years ago #

    Easy for you to say, I'm not a coder :)

    I'm setting up some conditional bits which mostly work, but "is_home" is going utterly ignored--it's returning nothing on the home page, but "is_page" and "is_single" work fine:

    <php if (is_home() || is_page() || is_single()) { ?>
    <php akpc_most_popular_in_cat(10,'<li>','</li>',61); ?>

    <php } elseif (is_category()) { ?>
    <php akpc_most_popular_in_cat(10,'<li>','</li>'); ?>

    <php } elseif (is_month()) { ?>
    <php akpc_most_popular_in_month(10,'<li>','</li>'); ?>
    <php } ?>

    Ideas?

  12. Karb
    Member
    Posted 9 years ago #

    Hi there,

    Great plugin
    I too have the errors mention and yes I have categories not used. I also get it for 'Last Year' - Warning: Invalid argument supplied for foreach() in /home/editor/public_html/news/wp-content/plugins/popularity-contest.php on line 940

    How do you limit 'most popular posts' in the side bar please?

    Thanks

  13. cou
    Member
    Posted 9 years ago #

    Was looking forward to using this, but for some reason it's altered something. My site now only displays one post per page - it has the "next page" links, but still only one post at a time. No other settings have been changed, no other files - deactivated the plugin, and deleted it from the server.

    Ideas welcome, please! Can't think what has gone wrong.

  14. WildDuck
    Member
    Posted 9 years ago #

    Hi Alex
    Great plugin

    I have the Line 940 error too

    Keep coding !

  15. Karb
    Member
    Posted 9 years ago #

    Does this screw up feeds as my feedburner link no longer works I get: Error on line -1: Premature end of file. on Feedburner or do you think that is unrelated?

    Thanks

  16. Alex King
    Member
    Posted 9 years ago #

    cou - I don't see the problem you describe on your site

    Karb - I don't see why it would hurt your feeds, however I've changed the plugin for the next release so that it doesn't show popularity in the feeeds. I don't think I understand you sidebar question.

  17. Karb
    Member
    Posted 9 years ago #

    Alex: thanks for that. Regards sidebar, it currently shows 10 post titles - I would like to show 5. Thats all :)

    Thanks

  18. Alex King
    Member
    Posted 9 years ago #

    When you call the function, add the number you want to show:


    <php
    akpc_most_popular_in_cat(10);
    akpc_most_popular_in_cat(10);
    akpc_most_popular_in_month(10);
    ?>

  19. Karb
    Member
    Posted 9 years ago #

    Alex: that was too easy :) sorry.

  20. cou
    Member
    Posted 9 years ago #

    Alex, I removed it - deactivating the plugin didn't remove the DB tables the plugin created also. I think it conflicts with the wp-cache plugin...

  21. Alex King
    Member
    Posted 9 years ago #

    I don't think de-activating the plugin should remove the tables, if you re-activate it the old data is still valid (and it will "catch up" with new posts).

    I don't think it conflicts with wp-cache, but if you use wp-cache I imagine it won't work for views since the WP hooks aren't used.

  22. Karb
    Member
    Posted 9 years ago #

    Oh it won't work with wp-cache - thats a bit of a downer. Is there anyway to make it work with wp-cache? wp-cache makes wp so much faster.

    Thanks a lot.

  23. Alex King
    Member
    Posted 9 years ago #

    See, the way caching speeds things up is by not processing pages - if the page isn't processed, it's a bit hard to count the page view.

  24. Alex King
    Member
    Posted 9 years ago #

  25. Karb
    Member
    Posted 9 years ago #

    Hi Alex,

    Where is beta 2 download link. The only link I found was to beta 1.

    Thanks for your efforts.

  26. normgregory
    Member
    Posted 9 years ago #

    Beta 2 looks great right out of the zip file and solved all the errors I got from Beta 1.

    Very cool plug-in . . . you must of been some kind of math geek in school. Hahaha.

  27. Karb
    Member
    Posted 9 years ago #

    Yep everything is working fine now. In my dashboard admin the numbers for some reason are slightly cut off for the 'Most Popular Posts' but thats only an asthetic thing :)

    Great job!

  28. Arlo
    Member
    Posted 9 years ago #

    Thanks for the great update. Is it normal to have a huge number under feeds? All my homepage postings have the same big number for feeds, and I'm seeing the same thing for category and archive views; the top 6 or 7 posts have the exact same number.

  29. newy
    Member
    Posted 9 years ago #

    I have a problem when viewing an entry that has a trackback/web link it it. If you go in to edit that entry and go to the bottom to preview the entry I get something that looks like this.

    Post Preview (updated when post is saved)
    Title
    Filed under: General � @ 9:22 am

    Warning: Invalid argument supplied for foreach() in path-to-blog\wp-content\plugins\popularity-contest.php on line 1248
    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

    I only get this error on the entry that has the link or trackback in it. The entry looks fine when viewing the blog.

  30. Rhyndman
    Member
    Posted 9 years ago #

    A cool option would be to allow discounting of pingbacks sent from own site - my popularity numbers are being skewed because I often link back to my old posts in my new ones.

    Love this plug in ....

    Thanks, Alex!

Topic Closed

This topic has been closed to new replies.

About this Topic