WordPress.org

Ready to get started?Download WordPress

Forums

Top 10 - Popular posts plugin for WordPress
[resolved] Does not Count for some posts! (22 posts)

  1. Navahang
    Member
    Posted 5 months ago #

    Hi,
    Thank you for great Plugin!

    I have notice the very unusual issue with the plugin!
    It does not count for the 90% of posts in one of the categories.

    For example it does count the visits for this post: Link , and for very similar post like this Link does nothing! both of this posts are in the same category. please note that I have no such an issue on other categories.

    Kind regards

    http://wordpress.org/plugins/top-10/

  2. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    I don't see anything wrong with the code. Do you have any of the category exclusions in place?

    What are the other categories that they do work on?

    Can you also try deselecting the option W3 Total Cache option?

  3. Navahang
    Member
    Posted 5 months ago #

    Thank you for reply!

    I do not have any category excluded!

    These are links from other categories:
    Link1 | Link2 | Link3
    -
    Also I tried deselecting the W3 Total Cache option and it turns working after that only for logged in users, because W3 do not cache pages for logged in users, but after deselecting this option plugin does not work for rest of users (not logged in).

    Kind regards.

  4. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    To be honest, I've never seen a behaviour where only a certain category doesn't track properly.

    Is there anything specific about this particular category?

  5. Navahang
    Member
    Posted 5 months ago #

    No, there is nothing specific about this particular category!
    I have checked the mySQl tables and I found out that there is no table for these post ids on top10-table! even I create the table manually for those posts, but still they don't get updated!!!

  6. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    Navahang, there is little I will be able to do without access to the files to try and figure out what's going wrong since this is really the first time that I've come across such a problem.

    Can you check your error_log file to see if there are any errors being generated by the plugin when you visit this category?

  7. Navahang
    Member
    Posted 5 months ago #

    Thanks for reply!

    You can download my error_log file from this Link and see if you can help me.

    Regards

  8. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    Hi, 4shared requires to have an account to download files so that link above doesn't work for me.

    Can you check if there are any references to "tptn" or "top-10" or "addcount.js.php" in your error_log file?

    Also, I was also wondering if you can temporarily disable W3 Total Cache to see if the counting works. Just to test if its a problem with a clash between the plugins.

  9. Navahang
    Member
    Posted 5 months ago #

    I uploaded to my server now you can download it:
    Link

  10. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    I can't see anything in the error logs. Were you able to test with disabling W3 Total Cache?

  11. Navahang
    Member
    Posted 5 months ago #

    I tried deselecting the W3 Total Cache option and it turns working after that only for logged in users, because W3 do not cache the pages for logged in users, but after deselecting this option plugin does not work for rest of users (not logged in).

  12. Ajay
    Member
    Plugin Author

    Posted 5 months ago #

    I mean if you deactive W3 Total Cache plugin temporarily to test.

  13. Navahang
    Member
    Posted 4 months ago #

    Yes, I tried deactivating W3 Total Cache also, but still doesn't work!

  14. Ajay
    Member
    Plugin Author

    Posted 4 months ago #

    I've pretty much run out of most options.

    Please backup the files before you proceed.

    Can you try editting this piece of code in top-10-addcount.js.php ?
    I have just added some text which will be outputted on your page which we can see which part of the loop it is falling into.

    Change the following lines:

    if($id > 0) {
    	                $wpdb->query("INSERT INTO $table_name (postnumber, cntaccess) VALUES('$id', '1') ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ");
    	                $current_date = gmdate( 'Y-m-d', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
    	                $wpdb->query("INSERT INTO $top_ten_daily (postnumber, cntaccess, dp_date) VALUES('$id', '1', '$current_date' ) ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ");
    echo 'document.write("<!-- In loop -->")';
    	        }
    echo 'document.write("<!-- Out loop -->")';
    	}
  15. Navahang
    Member
    Posted 4 months ago #

    I have edited the lines and now does not work at all!

  16. Ajay
    Member
    Plugin Author

    Posted 4 months ago #

    I created a gist with the code for the entire file.

    https://gist.github.com/ajaydsouza/79132481ca8e6fca0620

    Can you please give this a try.

  17. Navahang
    Member
    Posted 4 months ago #

    Thanks for reply!

    I have uploaded the new code! now for normal posts it starts working like before, but for that particular category, still does not work!!!

  18. Ajay
    Member
    Plugin Author

    Posted 4 months ago #

    Hi,

    I'm sorry. I just can't figure out what could be the problem without having access to the files. The code seems to be rendering properly, but I am not sure why the hits on only this category of posts are not being counted.
    I can see the code adding in just the same like other categories' posts.

    Just to confirm, if you check wp_tptn tables you have no entries for '59707' in the postnumber column?

  19. Navahang
    Member
    Posted 4 months ago #

    Hi,

    There is entries for '59707' , this is one the post in that particular category in which we have issue, but the plugin works for this post as I told you for some of the posts in this category , plugin works! (Let say, 5% of posts in this category)

    I believe some thing is wrong with ajax coding, because when we are deselecting the option for W3 cache, and the normal code is loading, plugin works fine! but as we have to use W3 cache we cannot keep deselecting that option.

    Before I was using another plugin called "AJAX Hits Counter + Popular Posts Widget" and it was working very fine. this is the code which plugin was injecting to pages:

    <script type="text/javascript">function ahc_getXmlHttp(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=false}}if(!e&&typeof XMLHttpRequest!="undefined"){e=new XMLHttpRequest}return e};var ahc_xmlhttp=ahc_getXmlHttp();ahc_xmlhttp.open("GET", "http://www.navahang.com/wp-admin/admin-ajax.php?action=ajax-hits-counter-increment&post_id=67551&t="+(parseInt(new Date().getTime()))+"&r="+(parseInt(Math.random()*100000)));ahc_xmlhttp.send(null);</script>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    anyway, thank you again for your kind help and attentions to this issue.

  20. kutsy
    Member
    Posted 4 months ago #

    Navahang, thank you for using my plugin :-)

    (Author of "AJAX Hits Counter + Popular Posts Widget")

  21. Navahang
    Member
    Posted 4 months ago #


  22. Ajay
    Member
    Plugin Author

    Posted 4 months ago #

    You're welcome Navahang. I wish we could have figured this out!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.