MostWanted – a Popular Posts Plugin for WordPress

This WordPress Plugin which lists the most popular posts in a blog, according to the records held by StatTraq

MostWanted lists the most popular posts on a wordpress powered weblog. This list can be used in the sidebar to provided visitors with an indication of what are the most visited pages.

The MostWanted plugin in use.It’s grown a little since it’s original release so it has a subtle API change. Where previously it was called “rjb_mostwanted”, it is now “MostWanted::mostwanted”. Currently there is a wrapper around the old method name so that it still works, however this will be removed in future releases.

Installation

  1. Download this fileDownload this file
  2. Rename it mostwanted.php and copy it to your /wp-content/plugins folder.
  3. using wp-admin, enable the plugin

Usage

The plugin provides one method of interest: MostWanted::mostwanted($top_n, $trim_chars, $showviews). The three parameters are:

  1. $top_n
    the number of results to list default = 5
  2. $curtail
    0 for no text curtailment, or ‘n’ the number of characters from each post title that shoudl be displayed. e.g. Curtailing “My Dynamic Badger” to 10 characters would read “My Dyna…”.
    default = no curtailment
  3. $showviews
    true if the number of times each post has been viewed should be included in the list.
    default = false
  4. $show_views_in_tt
    TT is short for ToolTip setting this value to true includes the number of views as part of the tool tip. i.e. if you hover over the text the (1234 distinct viewers) message is shown.
    default = true
  5. $duration
    restricts the duration of the query period so that only the last $duration days are considered when measuring popularity. e.g. a value of 30 would return the number of users only within the last 30 days. Leaving the value unset, or 0, results in the all-time results being returned.
    default = 0 (all-time)
  6. $pre
    this is a text string that is added to every line.
    default = <li>
  7. $post
    this is a text string that is added to every line.
    default = </li>
  8. $method
    there are two ways of identifying unique visitors, neither of which are perfect, the default is to recognize only unique IP addresses, which means that if several people from one company visit, then they may show as a single user. Alternatively, using the session_id is not perfect because some users refuse to set cookies.
    default = ip, alternative = session
  9. $as_percentage
    if set to true, then the number of hits for each page as a percentage of the site total is displayed instead of the hit count itself. This may be desirable if you want to show popularity without letting on how many hits you get for each story.
    default = false
  10. $timeout
    adjusts how long the most-wanted information is cached for before being replenished from the db. A value of 0 (zero) will result in fresh data being retrieved for every query, whereas a value of 3600 will only query the database once every hour, cacheing the output and thus reducing DB load.
    default = 1800

The simplest way to use the plugin is therefore to augment your page with:
<ul>
<?php MostWanted::mostwanted(); ?>
</ul>

A more tuned version might read:
<ul>
<?php MostWanted::mostwanted(7, 30, true); ?>
</ul>

License

MostWanted is released under a Creative Commons License.

Credits

If you find MostWanted useful, please feel free to link or a trackback to this entry.
Thanks to everyone whose commented with problems, solutions & suggestions, especially:

About these ads

222 thoughts on “MostWanted – a Popular Posts Plugin for WordPress”

  1. Pingback: rich boakes
  2. I just installed it and started clicking links to load up the stats. I can see the link hits but the first 2 most popular are not listing.
    response: Ah! this is a hangover from an earlier test version. installed plugins should change the sql statment from reading “DESC LIMIT 2,$top_n” to “DESC LIMIT 0,$top_n”. I’ve updated the copy on this page.

    Also “Reader Dave’s Double Wall” gets a slash added to “Reader Dave/’s Double Wall.”
    response:Looks like an escaping issue – will investigate.

  3. With: <?php rjb_mostwanted(10, 30, true); ?>
    i receive the error: Warning: Invalid argument supplied for foreach() in /home/html/wordpress/wp-content/ plugins/MostWanted.php on line 54
    can you help me please?
    Thanks!
    response: investigating…
    update: cannot reproduce – need more info – are you using url rewriting?

  4. Pingback: rich boakes
  5. I have WP installed 2 times on my site, in the same DB but with different tablenames, as well as stattraq plugin on both.

    MostWanted plugin works, but not right. On one blog it shows what is correct, on the other it shows the wrong titles, right links though. The wrong titles are from my other blog …

    Any clue? (I don’t have this on my blog, but on a separate php file not linked)

    rich: possibly (hopefully) fixed by the 0.0.4 release.

    Also, I did have to put a "." at line 60 before the slash to make the links go to the right folder WP is installed in for each.
    such as: "./index.php?p=" Would that be messing it up?

    rich: That would explain the links being “right” but the titles being wrong.

  6. The error referred to in post #4 seems to come from SEO use (mod_rewrite that is). I’ll look into the code to see if there’s something to be done. This looked promissing.

  7. IS this thing on?

    response: yes it is. and in answer to your other (repeated) question, my email address should be pretty simple to guess since you know the domain name already…

  8. I’m getting a database error (table doesn’t exist) on my main page. I’m using the function in a php file in the public_html root directory rather than the /blog directory my blog is in. Am I doing something wrong?

    rich: hmmm. i just took a look at your site and i can see that stattraq is working normally, so initially i’m stumped… i’ll have a root around. is everything else normal? are you running this in a page where you’ve already done: require('wp-blog-header.php');

  9. Pingback: rich boakes
  10. I’m getting the same error as post #4

    Fresh install of Apache 2 on XP professional.

    WordPress 1.22

    don’t know what I’m doing much more than that!

    Warning: Invalid argument supplied for foreach() in yadayada…wp-contentpluginsmostwanted.php on line 57

  11. Hey, trying out your plugin. Is there a place to get the code without cutting and pasting ? Right now I have to go in an manuall erase all the line numbers….

  12. Thanks for the suggestion Darryl, there’s a quirk between IE and Firefox that I’d not noticed – IE copies only the text, whereas Firefox copies the line numbers too. I’ve added a downloadable version as requested.

  13. I’m getting the invalid argument error as well, WP 1.5. Any fix for this?

    Another question– is there any way to include or exclude categories? For example, I would want toshow just the top 5 hits from posts in category X and y..

  14. Kubrick was the starting theme, but its way past resembling it anymore :)
    The code is in my sidebar. See my email addy for the site.

  15. I’ve just updated the plugin to 0.0.6. The changes are unlikely to affect the error, but if you can update your version then at lest your errors and my version number will be consistent.

    FWIW The 0.0.6 update isn’t particularly impotant and doesn’t need upgrading to unless anyone else has a problem. It’s a formalization of the things I’ve been doing to stattraq to combat referral spam.

  16. Same error:

    Warning: Invalid argument supplied for foreach() in /wordpress/wp-content/plugins/mostwanted.php on line 65

  17. Thanks Steve, I think the problem may be that you’re using permalinks, and specifically, that you were using permalinks since before stattraq started recording data. The result is that there are no records in the database with a post ID; and consequently we see the error.

    [if that's the case, thanks for helping me track it down!]

    I’ve just made a 0.0.7 build available which:
    should fail gracefully, please tell me if it doesn’t andincludes a new method called fixstats, which can update (repair) the entire stattraq database so that the stats are correct.

    To use fixstats, you need to download this file and save it in your wp-stattraq directory as “fixstats.php”. To run it, open stattraq as normal then add “fixstats.php” to the URL. Depending on the volume of stats you have recorded it should take between zero and several minutes to complete.

    Hopefully, once this is run, the error will go away.

    But that’s not all. You need to tweak the stattraq code a little in order to avoid having to do this again (Randy has promised this will be solved in the next release of StatTraq).

    open up stattraq.php and look for

    [php]if (($p != ”)){
    $p = intval($p);[/php]

    Which will be around line 25. Replace the above two lines with

    if (($post->ID != ”)){
    $p = intval($post->ID);

    and your MostWanted stats will forever remain up to date.

    I hope.

    Let me know how you get on.

  18. Thanks for helping out. Am I to understand the plug-in won’t work with permalinks at all? Or is this fixstats meant to correct for that?

    Anyway, two problems that keep me from proceeding. Your link to “fixstats.php” is broken and I get this site-hosing error from 0.0.07:

    Parse error: parse error, unexpected ‘{‘ in /srv/www/arlo/automatorworld/htdocs/wordpress/wp-content/plugins/mostwanted.php on line 69

  19. MostWanted works with the stattraq stats, and it’s a curiosity of stattraq that if permalinks are used then it doesn’t record the post ID, so without the tweak outlined above, permalink based blogs won’t work with MostWanted (until StatTraq is updated – this is something that Randy is planning on fixing in the next release). In the mean time I’m using using permalinks on this site, with MostWanted, and it all does work, providing you change the 2 lines specified above :).

    re: your 2 problems – sorry, both fixed I hope – try again!

  20. Rich-

    So far, so good–I think. It’s been running about an hour now, but stattraq hasn’t updated with specific post hits yet..and thus mostwanted is showing “no results available”. How long should it take for new posts to filter into the db? I’ve had about 1,000 page views in the last hour.

  21. I ran fixstats.php, and after fixing the require path to “../wp-config.php” ;) I got this error:

    Fatal error: Class ‘SpamTraq’ not found in /wp-stattraq/fixstats.php on line 4

  22. As a goof I went into the sql and changed an entry ID from 0 to a real number, and sure enough it appeared properly. So for whatever reason the change to statrraq.php is going ignored. Sorry for 3 messages in a row…

  23. re: “Fatal error: Class ‘SpamTraq’ not found…” that’s my bad. Either remove “SpamTraq::” from the file or re-download it, I’ve replaced it at this end.

  24. Rich –
    ok, fixstats worked great! Still one problem: the hack to stattraq isn’t working; new post hits aren’t recording the ID.

  25. For clarity, here’s what I have in my stattraq.php from lines 25 to 37:

    // need to get the real article_id or type of server request (RSS, RDF, ATOM, Ping, etc)
    if(!isset($article_id)){
    //if (($p != '')){
    // $p = intval($p);
    if (($post->ID != '')){
    $p = intval($post->ID);
    $article_id = $p;
    }else if(isset($doing_rss) && $doing_rss == 1){
    $article_id = “Feed”;
    }else{
    $article_id = 0; // default/mixed page – not just for one article
    }
    }

    I’m wondering if the single quotes may have been munged by my server and hence it would have stopped working.

  26. I swapped out that portion, but still no post ID’s..everything is set as “0”. Maybe send me your whole stattraq.php file? Maybe you changed something else and forgot about it?

  27. A few additional things:
    – Although it is updating newer entries, when I run fixstats, it produces the identical list of 64 fixed entries every time.
    – Some RSS feed hits are being ignored (set to ‘0’). I guess this is a problem for Randy, but couldn’t hurt to mention it here (and he seems to be MIA for a month now).
    – I found a bug in your plugin, line 75: “‘ href=’/index-normal.php?p=” I changed that back to ‘index.php’

    Requests:
    – Can you add a parameter to list only the posts of given category(s)? For example, php rjb_mostwanted(10, 30, true, 1,2); would list only the top 10 posts in categories 1 and 2.
    – Would it be possible to change the above line 75 to use the permalink, if the WP install is using permalinks, instead of post ID?

    Thanks..
    Steve

  28. I’m getting an error that says maximum execution time of 30 seconds has been exceeded when running the fixstats function.

    What setting do I need to change?

  29. I have one problem: my listing (mostwanted pages on sidebar) shows correct URLs for articles, but incorrect URLs for pages.

    Pages have link syntax: /?page_id=number

    and your plugin shows /?p=number (wrong, this is syntax for articles, not for pages).

    Any help or idea?

    Many thanks, Martin

  30. My Popular shows for ever: No results available.
    But stattraq is still logging and works fine.
    Wordpress 1.5, any idea?
    Thanks

  31. Update: I’ve done a clean install of WP 1.5.1, on a completely different server, and I’m still having the problem of stattraq not recording permalinks, even with your modified code–I’m running fixstats.php every day manually :(

    I’ve cross-posted over at stattraq site in hopes to solve this..I really need it to work.

  32. Hi I am using WordPress 1.5 and hacked a quick solution to fix permalink storage in the database. My StatTraq now works for all permalinks. This is also specially set for permalinks using month, day, and year. Sorry if the naming is bad. I find the post_name in the database and check against the timestamp. You can adjust it if you use other formating. I dunno why but I can’t post on the StatTraq website. Please let me know how it goes. =)

    instructions:
    right under

    $article_id = 0; // default/mixed page - not just for one article

    place the following:

    // BEGIN MICHELLE CODE
    $myName = $_GET['name'];
    $myMon = intval($_GET['monthnum']);
    $myYear = $_GET['year'];
    $myDay = $_GET['day'];
    $mysqlQuery = "SELECT ID as pid, UNIX_TIMESTAMP(post_date) as pdate FROM wp_posts WHERE post_name='$myName'";
    $myOutput = $wpdb->get_results($mysqlQuery);
    if (isset($myOutput)) {
    foreach ($myOutput as $myline) {
    $sDate = getdate($myline->pdate);
    $myMon2 = $sDate['mon'];
    $myYear2 = $sDate['year'];
    $myDay2 = $sDate['mday'];
    if($myMon==$myMon2 && $myYear==$myYear2 && $myDay==$myDay2) {
    $article_id = $myline->pid;
    }
    }
    }
    // END MICHELLE CODE

  33. When I activate mostwanted I get this error in WP 1.5.1

    Warning: Cannot modify header information – headers already sent by (output started at /hsphere/local/home/dhthomas/glitteringstew.com/muse/wp-content/plugins/rjb_mostwanted.php:116) in /hsphere/local/home/dhthomas/glitteringstew.com/muse/wp-admin/admin.php on line 10

    But the mostwanted info. at least appears in the sidebar, though with no stats because I just installed it.

    David

  34. Hey, I tried running the fixstat script and I get this error
    Fatal error: Call to undefined function: fixstats() in /hsphere/local/home/dhthomas/glitteringstew.com/muse/wp-stattraq/fixstats.php on line 4

    I placed it in the wp-stattraq folder.

    Also, when I activate the mostwanted plugin in wp-admin I get this error

    Warning: Cannot modify header information – headers already sent by (output started at /hsphere/local/home/dhthomas/glitteringstew.com/muse/wp-content/plugins/rjb_mostwanted.php:116) in /hsphere/local/home/dhthomas/glitteringstew.com/muse/wp-admin/admin.php on line 10

    Please advise. I’m not sure what is going wrong.
    David

  35. I managed to get the statfix to run, but the links to the MostWanted list of posts still uses the post number, with a strange path, index.php?p=77, not the permalink. (I changed the index.php-normal to index.php, but no change in the link effectiveness)

    I changed the code for post ID as suggested by Rich above, I even added the snippet of code suggested by Michelle, since I use the date in the permalink.

    Any suggestions? Maybe I just need to wait for the new release of stattraq.
    David
    Sorry for so many comments.

  36. Infinite apologies, especially to rich. I got it. my blog is in a subdirectory, so I had to change the path from /index.php to /sub/index.php

    All is well. please ignore those messages above.

    Thank you for a fine plugin of a plugin. Now someone should invent a plugin for your plugin of a plugin.

    cheers,
    D

  37. I still can’t get the plugin to play nice with the admin headers. The plugin works on my blog, but shuts down admin, and the error code above is what I get, and later, a similar warning about wp-includes/plugable.php malfunction, again with headers.

    I really like this plugin and I hope I can figure out what is not clicking. Thanks for any input. David

  38. Hey, you might want to consider letting the mostwanted plugin filter out bots.

    $output = $wpdb->get_results( “SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.session_id) ) as cnt FROM $tablestattraq st,
    $tableposts p where p.ID=st.article_id and st.user_agent_type=’0′ GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,$top_n” );

    The key point being user_agent_type = ‘0’

  39. Also as an idea it’s a quick and easy change to your function to limit the results to ‘x’ days (which i like :)

    $output = $wpdb->get_results( “SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.session_id) ) as cnt FROM $tablestattraq st, $tableposts p where p.ID=st.article_id AND st.user_agent_type=’0′ AND DATE_SUB(CURDATE(),INTERVAL $interval DAY) < st.access_time GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,$top_n” )

  40. I hope you implement the sugestion above to use get_permalink on line 75 I implemented it on my install and it works great:
    "’ href=’" . get_permalink($line->article_id) . "’>"

  41. Another suggestion was to add category support I also added that to my install by first modifing the function declaration to accept an additional optional parameter ($cat_id):

    function rjb_mostwanted($top_n=5, $trim_chars=0, $showviews=false, $show_views_in_tt=true, $cat_id = -1){

    I then changed the query to factor in the category id passed or ignore if not passed:

    $output = $wpdb->get_results( “SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM $tablestattraq st JOIN $tableposts p ON p.ID=st.article_id LEFT JOIN $wpdb->post2cat pc ON p.ID = pc.post_id WHERE (IFNULL(pc.category_id, -1) = $cat_id OR $cat_id

  42. Hi Rodney,

    I am delighted to confirm that permalinks are in the latest version (0.1.0), and that I’d had forgotten all about it, so I’ve updated the change log too, thanks for the prompt.

    Also it looks like your useful category addition got clipped somehow. If you repost it I’ll have a go at integrating it into 0.1.1.

    Rich

  43. Here is the query code:

    $output = $wpdb->get_results( “SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM $tablestattraq st JOIN $tableposts p ON p.ID=st.article_id LEFT JOIN $wpdb->post2cat pc ON p.ID = pc.post_id WHERE (IFNULL(pc.category_id, -1) = $cat_id OR $cat_id < 0) “.$futureSpamOption.” GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,$top_n” );

  44. Thanks for that Rodney,

    I’ve coded something functionally similar (but less elegant) in the past and since that means there’s at least two of us who think it would be useful I’ll add it to the 0.1.1 release.

    Ultimately what I’d like to see it do is:

    accept white and black-lists for multiple categories, enabling the blog owner to focus attenion on certain sections of the site.
    optionally handle hierarchical categories, so for example, if one were to select the general category on this blog, I’d like to be able top optionally include or exclude ‘n’ sub-categories.

  45. Well maybe I can help with that.

    You could change the function declaration like this:

    function rjb_mostwanted($top_n=5, $trim_chars=0, $showviews=false, $show_views_in_tt=true, $cat_white_list=”, $cat_black_list=”){

    And then change the query to the following two lines:

    $cat_where = “((“.($cat_white_list!=” ? “IFNULL(pc.category_id, -1) IN ($cat_white_list) OR ” : “”).”‘$cat_white_list’ = ”)”. ($cat_black_list!=” ? ” AND p.ID NOT IN (SELECT pc2.post_id FROM $wpdb->post2cat pc2 WHERE pc2.post_id=p.ID AND pc2.category_id IN ($cat_black_list))” : “”).”)”;

    $output = $wpdb->get_results( “SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM $tablestattraq st JOIN $tableposts p ON p.ID=st.article_id LEFT JOIN $wpdb->post2cat pc ON p.ID = pc.post_id WHERE $cat_where “.$futureSpamOption.” GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,$top_n” );

    The way this would work is the two new parameters would take optional comma seperated lists.

    For example to return most recents in categories 5 and 3:
    rjb_mostwanted(5, 0, false, true, ‘5,3’);

    For example to return most recents in categories 5 and 3 but not if also in 9:
    rjb_mostwanted(5, 0, false, true, ‘5,3’, ‘9’);

    For example to return most recents in categories 5 and 3 but not if also in 4 or 9:
    rjb_mostwanted(5, 0, false, true, ‘5,3’, ‘4,9’);

    For example to return most recents in all categories with the exception of 4 or 9:
    rjb_mostwanted(5, 0, false, true, ”, ‘4,9’);

    Note this is backward compatable with my first solution.

  46. I am getting a strange error when i click on the activation button. Suddenly this appears at the top of my Dashboard
    Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/blog/wp-content/plugins/mostwanted_0.1.0.php:183) in /var/www/html/blog/wp-admin/admin.php on line 10

    Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/blog/wp-content/plugins/mostwanted_0.1.0.php:183) in /var/www/html/blog/wp-admin/admin.php on line 11

    Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/blog/wp-content/plugins/mostwanted_0.1.0.php:183) in /var/www/html/blog/wp-admin/admin.php on line 12

    Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/blog/wp-content/plugins/mostwanted_0.1.0.php:183) in /var/www/html/blog/wp-admin/admin.php on line 13

    see for yourself

    any idea what’s going on?

  47. The usual reason for seeing this is if there’s been any space introduced before or after the opening and closing php statements in the plugin i.e. the very first characters in the plugin must be <?php and the very last must be ?> with no newline or space after it.

    This is a quirk of wordpress/php and is the reason why I provide a phps file rather than pasting the code on this page.

    I added a newline to the 0.1.0 code and was able to reproduce similar output to what you saw. If this is not what’s given you the error, then we’ll have to dig deeper.

  48. yeah that was it, there was a space at the end of the file. All better now!!!1

    thanks for the great plugin :)

  49. sorry, 1 more slight problem

    right before it lists the most viewed entries i get an error message in the side bar saying:
    “Warning: Missing argument 5 for mostwanted() in /var/www/html/blog/wp-content/plugins/mostwanted_0.1.0.php on line 119″

    here is what is on line 119:
    117: class MostWanted {
    118:
    119: function mostwanted($top_n=5, $curtail=0, $showviews=false, $show_views_in_tt=true, $duration, $pre=””, $post=””, $method=”ip”){

    other than this error message everything seems to work fine. I can set all the parameters like number of posts to list etc and all the links work fine, just this error message in my sidebar is kind of an eyesore

    any ideas?

  50. I spotted that on your blog yesterday and implemented a fix last night (emailed your yahoo account about it) MostWanted 0.1.2 will I think (hope) fix the problem.

  51. wow, thanks for the quick update!

    i’m @ work right now so i can’t access my yahoo account or server for that matter to implement the update yet.

    I’ll test it out as soon as i get home and let you know how it goes.

    again thanks for the help and the great plug in

  52. i tried installing this plugin on wordpress 1.5, i had to rename the .phps plugin file to .php to get my plugin directory to recognize it, after that it outputs all th e plugin source to my plugin directory, i usually associate this with broken plugins, any ideas?

  53. Good catch, thanks. I’ve updated the installation instructions. You need to rename the file so that it has a .php extension, after which it should work without complication. Let me know if that isn’t the case.

  54. I am having the same issue as nick. I rename the file to php and drag it in to my plugins folder.

    i go to the plugins menu of wordpress… all the code of the plugin is written in there !!!!!!!… and it makes that page massive :)

    There must be an error somewhere in the code?

    Cheers

  55. To Ali and Nick, it may depend on what browser you are using to download. Not sure why, but when I downloaded using Safari I had the same problem you did; I tried this via both downloading the linked file and opening the link and saving as text. When I used IE (Mac) and saved the page as text, then changed the filename, it appeared correctly on WP’s plug-in page. I did not try just downloading the file with IE.

    Again, I have no explanation … but it does work.

  56. I have 0.1.2 running but get the “no results available” message. I’m not sure whether the issue is in StatTraq or Mostwanted — in StatTraq all pages are being classed as “Multiple Posts,” which I believe is our main page. Although I know from another stats program that we’re getting many hits to permalink pages, these seem to all be rolled into this “multiple posts” group. So would that cause the “no results” message, or is something else going on in MostWanted?

    For what it’s worth, our permalink pages are in the format yyyy/mm/dd/title. Also, the blog is in a subdirectory (as in Garnet’s 6/7 post) but that subdirectory has its own domain. I couldn’t see any place where this would affect the path to index.html.

    Does anyone have any ideas?

  57. why do i get
    ” Fatal error: Call to undefined function: popular() in /home/me/public_html/blog/wp-content/themes/ocadia/sidebar.php on line 38 ”
    did i miss some configuration ?

  58. Hi Rakhmat – I think the problem is that you’re calling a method called "popular()", and the MostWanted plugin does not have such a method. If you change your call to read MostWanted::mostwanted() then it should work… assuming you’ve activated the MostWanted plugi, and already have StatTraq installed.

  59. hehe ,i am using the last version of stattraq,but i have found that the “counter number” in the sidebar is different from the “user hit” in the /wp-srattraq/index.php,so i want the sidebar shows the “user hit” in the sidebar! what can i do for it?
    so sorry that my spelling english is not so good!i come from chinese.

  60. Hi Hansen, the mostwanted function allows you to enter a method for how things are counted. The default method is IP address, however, you can also use session ID’s, which should give you the same numbers you see in stattraq.

    Both have shortcomings:

    IP address falls down when you have large groups of people coming through the same router (if it uses Network Address Translation (NAT)) because they all appear to have the same IP. For example, when my wife or her office buddy visit the site, they both appear to have the same IP address, so viewer numbers appear lower than they really are. In use, it looks like this:MostWanted::mostwanted(, , , , , , , "ip");
    SessionID fails because some users don’t allow cookies to be set, so every page they visit gets a new session ID. The result is that user numbers appear higher than they really are. MostWanted::mostwanted(, , , , , , , "session_id");

    So, to switch to session_id based counting, set the eighth parameter to “session_id”.

    There is no ultimate solution to this, you just have to understand the issues and account for them. If you have any problems post your current function call and I’ll take look.

  61. thanks a lot for your reply,and you give me a lot of knowledge that i really do not know!
    and i will do it as you suggested.

  62. I can’t get the Mostwanted plugin to work with my site.
    I’m using WordPress 1.5.1.3, stattraq and mostwanted (both the latest versions). They are enabled in the pluginscreen. Stattraq works, but Mostwanted doesn’t register any statistics. It just says: No results available.
    I have installed it yesterday morning, and I had some people click the links to generate some statistics.
    Any ideas?

  63. Hi Geekess,
    you’re seeing an artefact caused by stattraq not handling permalinks 100% perfectly. There are assorted minor hacks that vary based on permalink structure. Michelle Li posted her solution here a while back, and having taken a quick look at your site it looks like the code will fit the bill for you.

    You can also knock your existing records into shape using the MostWanted::fixstats() function, which assigns the correct postid in cases where it’s missing (which is what happens when permalinks are used).

    To use it, create a file called fixstats.php and to that file add:

    <?php MostWanted::fixstats(); ?>

    Depending on the size of your database it will take between a jiffy and an age to complete.

  64. Great, Randy has said the next version of StatTraq will support permalinks by default, so such shenanigens shouldn’t be necessary any more.

  65. Morning Rich,

    If I include Michelle Li’s fix (linked to above?) will it sort out my
    >> No results available problem?

    I installed Stattraq and your MostWanted plug-in last night, but have not been able to use it to display on my site.

    In which file does Michelle’s fix need to go?

    Cheers,

    Steve

  66. Hi Steve, short answer, yes, these are the droids you’re looking for.

    The longer answer is that the code needs to go in stattraq.php which is in your plugins directory. The suitability all depends on the structure you use for your permalinks. Personally I don’t use dates in my URI’s because I prefer to make each story name unique, this gives me shorter links, which readers tend to prefer.

    For reference, my stat_traq_event function, which only works for “dateless permalinks”, looks like this – you’ll (of course) note that my SQL statement includes the delayed directive, that makes stattraq much faster:

    [php]function stat_traq_event($passed_param){
    global $doing_rss, $p, $post, $tablestattraq, $tableposts, $wpdb, $browser_type;
    $wpdb->hide_errors();
    $s_id = session_id();

    // need to get the real article_id or type of server request (RSS, RDF, ATOM, Ping, etc)
    if(!isset($article_id)){
    //if (($p != ”)){
    // $p = intval($p);

    $article_id = 0; // default/mixed page – not just for one article

    if (($post->ID != ”)){
    $article_id = intval($post->ID);
    }else if(isset($doing_rss) && $doing_rss == 1){
    $article_id = “Feed”;
    }else{
    if (isset($_SERVER['QUERY_STRING'])) {
    parse_str( $_SERVER['QUERY_STRING'] );
    if (isset($name)) {
    $query= ‘select id from wp_posts where post_name = “‘.$name.'”‘;
    $p = $wpdb->get_var($query);
    if ($p!=”) { $article_id=$p; }
    }
    }
    }
    }

    if(!isset($s_id)){
    $s_id = session_id();
    }

    $urlRequested = $_SERVER['PHP_SELF'] . (isset($_SERVER['QUERY_STRING']) ? “?”.$_SERVER['QUERY_STRING'] : ” );
    $ipAddress = statTraqGetIPAddress();
    $browser = statTraqGetBrowser();
    $referrer = (isset($_SERVER['HTTP_REFERER']) ? “‘” . $_SERVER['HTTP_REFERER'] . “‘” :”NULL”);
    $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : “NULL”);
    $search_phrase = statTraqGetSearchPhrase($referrer);
    $spamFlag = statTraqGetSpamFlag($referrer);

    if (!strstr($_SERVER['PHP_SELF'], ‘wp-admin’) && !strstr($_SERVER['PHP_SELF'], ‘wp-stattraq’)) {
    $wpdb->query(“INSERT delayed INTO $tablestattraq (session_id, access_time, ip_address, url, article_id, referrer, user_agent, browser, user_agent_type, spam, search_phrase) values (‘$s_id’, NOW(), ‘$ipAddress’,’$urlRequested’, ‘$article_id’, $referrer,’$userAgent’,’$browser’, ‘$browser_type’, $spamFlag, “. ($search_phrase==null?”NULL” : “‘$search_phrase'”) . “)”);
    }
    $wpdb->show_errors();
    return $passed_param;
    }[/php]

  67. Great plugin but I’m having problems. Since I first activated your plugin, I suppose it read stats from stattraq and gave me some output. Now, it’s been over a month and a half and the stats aren’t changing. I.e. the top post according to your plugin has 7 views whereas stattraq states that my top single post is 27 views. What gives or am I just stupid? Here is the snippet I am using in my sidebar (included within php of course):

    MostWanted::mostwanted(10, 120, true, true, 0, ”, ”)

  68. Hi Mayur. I notice from looking at your site that you’re using permalinks. So my guess is that previously you weren’t. This would explain why the plugin worked ok for a while.

    As discussed in the earlier comments, this is due to a bug in stattraq that I’m hoping (and kind of expecting) will be fixed in its next release.

    In the mean time you might want to look back through the comments for suggestions of how to work around the issue – if it doesn’t solve the problem I’ll investigate further.

  69. Nevermind my previous comment, I figured out where to put it but it doesn’t work (I deactivated and activated the plugin twice). In response to your earlier comments, I have ALWAYS had permalinks and I have never turned them off. Any other ideas?

  70. Hopefully this will narrow down the problem area a bit…

    You can check in the stattraq table of your database to see that the fix is working. what you’re looking for is in the article_id and url fields.

    SELECT url, article_id from 'wp_stattraq' where url like("%oldest%") order by line_id desc;

    Wherever you see a url field like:

    /index.php?name=the-oldest-old-people&page=

    You should also see a non zero number in the article_id column, this is the post’s id, and MostWanted uses this information, looking at the source of your article I’m guessing the oldest old people article is post #95.

    If you see 0 (a zero) in the article_id column when there are names in the url column, then it’s the fix that’s not working, rather than the plugin. Once we’re sure it’s the plugin I can dig deeper.

  71. I get the following error after activating the plugin

    Parse error: parse error, unexpected T_VARIABLE in /home/heather/public_html/pro/wp-content/plugins/mostwanted.php on line 142

  72. Hi Heather, as a sanity check I just re-downloaded version 0.1.4 from this page and re-installed it on this site, but failed to get the error that you describe. Can you double check that you have this latest version?

  73. I got it working shortly after i posted this but came up with another problem when viewing single post

    WordPress database error: [Table 'jennifer_pro.st' doesn't exist]
    SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM st, wp_posts p where p.ID=st.article_id AND p.post_status=’publish’ AND st.user_agent_type=’0′ GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,5

  74. Hi,

    [Wordpress 1.5.1.2 + MostWanted Version: 0.1.4]

    After putting

    in sidebar.php

    I’ve got this:
    Fatal error: Non-static method MostWanted::mostwanted() cannot be called statically in /home/(…)/sidebar.php on line 25

    The plugin is activated, statraq works well, so? What’s wrong?

  75. To just list the top 5 posts seems a bit limited. I’d love to see a plugin that lists, say, the top 25 or 50 posts. When you have 900 posts, including that many posts in the list is meaningful.

  76. Hi Richard, the Usage section in the main article above mentions the $top_n parameter which controls precisely the behaviour you describe – all you have to do is specify how many posts you’d like to see.

  77. Hey Rich,

    Thanks so much for this plugin. It’s really great. One thing though – I’ve noticed that my stattraq queries are REALLY slow. Is there anyway to get Most-Wanted to cache it’s results, and only update it self once a day (or something)?

    I’m taking a look at some caching plugins, but haven’t had any luck getting them to work.

    -Vince

  78. Hi Vince, for this site I use wp-cache which caches every page that is accessible by your readers. This has the effect of making the site (in general) feel a lot faster. What this won’t do is speed up your stattraq-specific page access time (because stattraq lives under the wp-admin path, which is set to be uncached by wp-cache). You might also want to check out this minor modification which also helps by designating strtraq updates as a background operation.

  79. Rich,

    I noticed that the article names in the most wanted list are being curtailed even when the curtail parameter is set to zero. Looking at the code could I suggest the curtail function should be ammended as follows:

    function curtail($trim_this, $trim_chars=0) {
    if ($trim_chars > 0 && strlen($trim_this) > $trim_chars) {
    return substr($trim_this,0,($trim_chars-3)) . “…”;
    }
    return $trim_this;
    }

    Mike.

  80. Well, I was hoping to not have to ask any questions, but it looks like I’m getting errors again.

    Specifically, this error:

    Warning: ob_start(): output handler ‘ob_gzhandler’ cannot be used after ‘URL-Rewriter’ in /xxxxxxxx/wp-includes/functions.php on line 585

    I had applied the FixStats.php file last night and I thought that corrected my initial error (which by the way, was the exact same error). But after adding a new post tonight, it seems the error has returned.

    Ideas or fixes? I have seen the “Michelle Fix” but have not implemented as of yet, because my permalink structure is not the same as hers. I haven’t had time to tweak the code and try to make it work with my structure (year/month/day).

    Is there something else I can do to get the plugin to work correctly? I do like it, but if it doesn’t work with permalinks, I dont know how long I’ll leave it on the site.

  81. Okay…very odd.

    My previous comment (which for some reason is showing as a reply rather then a new comment itself…but thats another issue) seems to be no longer valid.

    That initial error showed up after I posted a new entry on my site. But I then ventured to another post and back to the main page, and the problem appears to have “disappeared.” The error is no longer on the homepage.

    Any ideas why the error would show up for the initial posting, but then disappear after a simple page refresh?

    A second new posting does not repeat the error…odd.

    Thoughts in general?

  82. Hi Scott, as far as I can tell the ob_start problem is not related to MostWanted or StatTraq: I’m seeing it intermittently on your blog too, so this may help. Hmmm… on reflection… the fact that it appears when I first arrive on a page, but then not afterwards, suggests it is related to StatTraq which uses “session_start();” so the fix is even more likely to work.

    Also, I’m fairly sure that Michelle’s code fix will work for you, without alteration, because of the way the .htaccess url rewriting extracts the variables (YMD) that Michelle’s code uses.

    Have a great thanksgiving, and don’t spend too much time hacking!

    P.S. Thanks for pointing out the “looks like a reply” issue; it was down to the CSS doing too much wrapping. I’ve improved the theme and it looks to have solved it.

  83. Ohhh, I always love replies that point out information that should actually help fix a problem!

    From the info you gave me and after doing a quick search of the WordPress support forums, it just looks like a WP issue itself, so not related to the plugin. Well, maybe to the StatTraq plugin, but not the MostWanted one ;)

    Thanks again for the info. I’ll try out the code fix and if that doesn’t work, then I’ll give Michelle’s code a try.

  84. Hey Rich, I’ve been meaning to drop by with a quick reply for the past few days. Regarding the gzip compression error in WordPress and the WeblogTools.com fix, it works, but doesn’t sort of.

    If you put the fix:
    php_flag session.use_trans_sid off

    In the index.php code as suggested, it has no effect. It does not work and this has been confirmed by multiple users on multiple themes.

    If you put it in your .htaccess file, it seems to break the newest version of WordPress. At least it does for me.

    BUT!

    If you create and place the code in a file named, “php.ini”, and place it in your blog’s root directory, then it will work.

    So again for anyone else with this problem – create a new file called “php.ini” and have that in your blogs root directory. In the newly created php.ini file, put in the following(minus the quotes): “php_flag session.use_trans_sid off”

    Save/upload the file and you should be set!

  85. Hi, I’m using WP 1.5.2, MostWanted 0.1.8 (according to the PHP file), and StatTraq 1.0a. I’ve run the configuration fixstats, I’ve inserted Michelle’s code and I’ve modified lines 25 and 26 in the StatTraq php file to read:

    if (($post->ID != ‘’)){
    $p = intval($post->ID);

    However, I’m still getting the “no results available” message. I’m using permalinks in the form of:

    http://DOMAIN/blog/index.php/yyyy/mm/dd/slug/

    Any other clues? You can see my “Most Wanted” links at the top of my blog, beneath the header logo.

    Regards,

    Rich
    BlogRodent

  86. RichT,
    From what I can see of Michelle’s code, there doesn’t appear to be a reason for changing lines 25+26 as well. Have you tried using it without that alteration?

  87. Tommy, a nice idea which I’d not considered (because i’m not using Skippy’s plugin) so if you (or anyone else) would like to submit a patch I’ll include it. The solution would just need a different SQL query.

  88. I’ve maybe found a bug:

    I want to have both a listing for both last 30-days and all-time in my sidebar.
    I use the code:
    Popular Posts: last 30 days

    ‘,”,ip,false,0); ?>

    Popular Posts: all-time

    ‘,”,ip,false,0); ?>

    when I have them this way it does not work correctly, i.e. the all-time list is identical to the 30-day list.
    when switching the order of the function calls, first with duration=0 and then with duration=30 it works OK…

  89. finally the same prob Chris Frazier has described.

    at first I didn´t get the plugin to work at all because of the browser-issue. The whole sourcecode turned up to be shown on the plugins-page. i fixed that.

    then i ran into the header-issue. fixed that.

    afterwards i ran fixstats.

    now i got the “cannot be called statically”-prob. i tried to understand the php5-manual-workaround but didn´t manage to.

    as php5 should not be that exotic in the wild i´d have thought that Rich would already have presented a solution… Sadly i was wrong.

  90. as php5 should not be that exotic in the wild i´d have thought that Rich would already have presented a solution… Sadly i was wrong.

    I think I’m flattered that you expect so much of me :) (but please note that I’m not a software development company, I’m just a bloke that is making the things he writes for himself available to others free of charge).

    I don’t have a server with PHP5 and I don’t have much free time, but I will be looking into it. If I can work out a fix I will publish it, if anyone else works it out, please submit it and I’ll make it available.

  91. thanx for replying at the speed of light.

    looking into the php5-manual it seems that this could be just a tiny thing to be changed. i would if i could, but unfortunately…..

    and besides: happy new year!

  92. Hi, I’d like to use your plugin and it basically works. But as soon as I activate it, the special German characters ä ö ü etc get gobbled up in the entire blog! Any clue on that?

  93. I downloaded the PHP file, renamed it, installed it on my WordPress setup and under the plugins section it displays the source of the file instead of the actual plugin listing! I opened up the file and was suprised to find a bunch of HTML tags mixed with php, is this correct? I tried downloading with my browser and with CURL and WGET and they all returned the same file. So what am I doing wrong? Thanks,

    Matt

  94. Hi Rich: i just activated the plugin and I get the following message in my sidebar:

    WordPress database error: [Table 'studyabroad.st' doesn't exist]
    SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM st, wp_posts p where p.ID=st.article_id AND p.post_status=’publish’ AND st.user_agent_type=’0′ GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,10

    Any Ideas? This is a wordpress install running on Windows IIS if that matters?

    You may see it in the sidebar here: http://www.cadc.auburn.edu/soa/studyabroad/

    I will keep it up for a bit in case you get time to check it out – thanks in advance.

  95. I get the same as this

    I downloaded the PHP file, renamed it, installed it on my WordPress setup and under the plugins section it displays the source of the file instead of the actual plugin listing! I opened up the file and was suprised to find a bunch of HTML tags mixed with php, is this correct? I tried downloading with my browser and with CURL and WGET and they all returned the same file. So what am I doing wrong? Thanks,

  96. i reckon the authors web server is html-ising all the .phps files. so none of them will work for anybody, just tried downloading an earlier version and got the same problem…

  97. Argh! Thanks for spotting that Ben. It seems someone’s installed a filter at a lower level then wordpress and it’s automatically html-izing the php script on the way through. I’m chaining the main download to a ZIP file now.

  98. does anyone know how to make stattraq to record stats for pages?

    It aparently only records hits for blog posts, and I love to use wordpress as a CMS

    I need to know if users have visited a certain page (like my resume download page, get it?)

  99. Found a small bug in the plugin. If StatTraq is Deactivated you recieve a SQL query error as shown in Rusty Smith’s comment above.

    This is simple to fix by adding a if block around the query call. I just added:
    if(isset($tablestattraq)) {
    to line 229 and closed of the if block on line 233.

  100. My previous post gave me an idea as to using this for other plugins not just StatTraq. I have recently started using a plugin called WP-PostViews and wanted to use the with MostWanted.

    What I did was modify the query sections of both the mostwanted and getHits functions.

    Here are the two code snippets:

    if(isset($tablestattraq)) {

        $q = "SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.$method) ) as cnt FROM $tablestattraq st, $wpdb->posts p WHERE p.ID=st.article_id AND p.post_status='publish' ".$futureSpamOption." AND st.user_agent_type='0' ".$dateOption." GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,$top_n";

        $output = $wpdb->get_results( $q );

    } elseif(function_exists('process_postviews')) {

        $q = "SELECT p.post_title, p.ID as article_id, CAST(meta_value AS UNSIGNED) AS cnt FROM $wpdb->posts p, $wpdb->postmeta m WHERE m.post_id = p.ID AND (p.post_status = 'publish' OR post_status = 'static') ".$futureSpamOption." AND meta_key = 'views' AND post_password = '' ORDER BY cnt DESC, p.post_date DESC LIMIT 0,$top_n";

        $output = $wpdb->get_results( $q );

    }

    And:
    if(isset($tablestattraq)) {

        $q = "SELECT COUNT( * ) as cnt FROM wp_stattraq st where st.user_agent_type='0'" . $futureSpamOption." ".$dateOption;
        $total_hits = $wpdb->get_var( $q );

    } elseif(function_exists('process_postviews')) {

        $q = "SELECT COUNT(CAST(m.meta_value AS UNSIGNED)) AS cnt FROM $wpdb->postmeta m WHERE meta_key = 'views'";
        $total_hits = $wpdb->get_var( $q );

    }

  101. I don’t see the number of view in brackets,
    I have wordpress 2.01,et mostwnated 1.8

    Thanks for help
    pascal

  102. Hi Pascal, can you paste the code that you’re using to call mostwanted – you’ll need to do remove the <?php and ?> so that it doesn’t get stripped off en-route.

  103. Rich,

    I was wondering if there was a fix for stattraq for wordpress 2.01… Its counting all of my hit to the admin pages and stuff… also, it double counts all the other pages, once as mixed and once as the right page.

    Also, I would like to enable WP-Cache, but when i do it pretty much destroys the tracking.

    Any help would be excellent,

    Justin

  104. Hi there,

    I have downloaded and saved the file as mostwanter.php and there after activated this from the Plugin panel.

    I had then placed this code `…` in sidebar.php. And I get this error

    WordPress database error: [Table 'wp_blog.st' doesn't exist]
    SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM st, wp_posts p where p.ID=st.article_id AND p.post_status=’publish’ AND st.user_agent_type=’0′ GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,7
    No results available.

    Could you please advice “what is wrong?”.

    Thanks in advance.

  105. Hi Rok, the query you’ve pasted is the key here. Where it says "... as cnt FROM st, wp_posts p ..." I would expect it to say "... as cnt FROM wp_stattraq st, wp_posts p ...". This suggests that the variable which contains the name of the stattraq table has not been set, which in turn suggests that stattraq has not been installed. I took a guess at what your stattraq url should be and I got a “not found” error. The answer is probably “you need to install stattraq“.

  106. Hi Rich,

    Thanks for the reply. I have checked all is working fine. The wp-config.php has got the correct user name/passord. Host and the DB Server running.

    I am confused what’s wrong?

  107. Rich,
    I created an enhancement so that this plugin works with the new Widgets plugin.

    To do this I added functions to the class. One produces the output for the Widget, One creates a control interface to set parameters, and the last initializes it. This last one is called using the plugins_loaded hook as it must run after the Widgits plugin is loaded.

  108. Sorry, but your plugin is incompatible with polyglot plugin and, maybe, some other filtering plugins.

    Please, change code in line 243 from

    $short = MostWanted::curtail($line->post_title, $curtail);

    to

    $short = MostWanted::curtail(apply_filters(‘the_title’, $line->post_title), $curtail) ;

    This little fix make plugin compatible with any filters for WordPress.

  109. Ahh, a widget version would be wonderful!

    I did try and look at converting it myself, but my PHP foo was insufficient and so I ran away screaming.. :-)

    Chris

  110. Homo-Adminus: thanks for the tip – it’s been rolled into the 0.1.10 release which also includes Rodney Shupe’s Widget code. Released soon… once it’s been tested by a few specially WordPress trained Flying Ninja Monkeys.

  111. andrezero – as far as I know it already does. I use pages on my site for my plugin documentation and they get hit often and are tracked in Stattraq – though I am still using 1.0a as I had trouble with 1.0b.

  112. Aha – instead of calling MostWanted::mostwanted(); this seems to (mostly) work:

    $m = new MostWanted();
    m->mostwanted();

    the odd thing I get now is that although the widget is configured to only show the top 5 I actually get the top 5 repeated twice..

    Go figure! :-)

    cheers, Chris

  113. Ok, I have taken a look at the mostwanted plugin code, since a site i am managing for one of our customers uses the plugin and I see a big load on the database caused by this plugin.

    Now, I see some form of caching is implemented, but i don’t see how this caching carries over to different processes. Is the $cached_result stored in the database somewhere? I’m probably gonna patch this thing up myself to do proper caching, but of course not if it has already been solved.

  114. I get this:

    WordPress database error: [Table '******.st' doesn't exist]
    SELECT COUNT( * ) as cnt FROM st where st.user_agent_type=’0′

    Warning: Division by zero in …

  115. Hi Lauren, initially this looks like a “no stattraq” problem. Is stattraq installed? Also, which version of wordpress are you using?

  116. I installed StatTraq, but there’s an error with that, my comment on StatTraq’s site isn’t even approved yet, though. That error said that I have no auth.php in my admin folder.

    I HATE 2.0, so I use 1.5.2.

    THANKS!

  117. Actually, when it’s turned off, uploading images is still horrible. I do have the plugin Iimage Browser for some blogs, which would work, then. And I have it for this blog. But there’s also that blue and the hiding menus every time I’m logged out. I don’t know. What do you think?

    I see there’s an apparent unofficial version, I think I’ll try that for now.

  118. I get the same error with your plugin now that I’m using that 1.5 version, and that one works.

    It’s good info, which I like anyway. Thanks for letting me know about it. If I don’t use your plugin, I can deal. Today, I set up a manual/static top pages thing that includes top images. So that’s extra special, if taking some work.

  119. Chris,

    When you inialize the plugin with a “new” it calls the constructor which is named the same as the class. As a result you are calling the mostwanted() function twice.

    Aha – instead of calling MostWanted::mostwanted(); this seems to (mostly) work:

    $m = new MostWanted();
    m->mostwanted();

    the odd thing I get now is that although the widget is configured to only show the top 5 I actually get the top 5 repeated twice..

    Go figure! :-)

    cheers, Chris

  120. Hi

    I’ve got version 1.9 and WP 2.03 but I can’t get your script to work. Whenever I add the following to my sidebar:

    I get the following error

    Fatal error: Non-static method MostWanted::mostwanted() cannot be called statically in /home/connecte/public_html/wp-content/themes/ag/sidebar.php on line 45

    Can you help me fix this please? StatTraq is working ok so I don’t think this is the problem

  121. Rodney wrote:

    When you inialize the plugin with a “new” it calls the constructor which is named the same as the class. As a result you are calling the mostwanted() function twice.

    That was is! Trivial patch and it appears correctly again.

    Emailing the file to Rich now after merging his validation fix.

    cheers!
    Chris

  122. I have instaled the plugin on http://www.curaj.net (see the bottom of the sidebar) but instead of showing the rating of a post it shows “???” what that measn!? Can u pls help me? I also would like to ad some dots after a post title wich is not comple, how do i do it!?

  123. Hi Moneyman, that suggests to me that you might not have stattraq installed, can you begin by confirming that please?

  124. I need help. Were do i put this?

    A more tuned version might read:

    Not in the header, where? IS that right?

    even after using the repair tool I still see this

    WordPress database error: [Table 'joeblstrn1234.wp_stattraq' doesn't exist]
    SELECT p.post_title, st.article_id, COUNT( DISTINCT (st.ip_address) ) as cnt FROM wp_stattraq st, wp_posts p where p.ID=st.article_id AND p.post_status=’publish’ AND st.user_agent_type=’0′ GROUP BY st.article_id ORDER BY cnt DESC LIMIT 0,7

  125. i have it on my puter but have no idea how to upload it.. instructions seem confusing…

    [time passes]

    ok, I think I did it right the plugin is activated and and files uploaded but still doesnt work please email me

  126. I am getting this when I try to configure..

    Currently there are

    WordPress database error: [Table 'aan3854.wp_stattraq' doesn't exist]
    SELECT count(*) FROM wp_stattraq WHERE article_id = ‘0’ AND url LIKE ‘/index.php?name=%’
    rows in your database that could be repaired.

    I have my own domain and have latest WP version installed…

  127. I the posts are still being answered and looked into.

    After activating the plugin and placing the code in the sidebar I see 3 question marks at the end of every post title in the list just like these….���

Comments are closed.