bsuite Bug Fixes (release b2v6)

[innerindex]Update: bugfix release b2v7 available.

It’s been a while since I released a new version of bsuite, my multi-purpose WordPress plugin. I’d been hoping to finish up a series of new features, but those have been delayed and this is mostly just a collection of bugfixes. This update is recommended for all bsuite users.

bsuite Features

  • Tracks page loads (hits)
  • Tracks search terms used by visitors ariving at your site via search engines
  • Reports top-performing stories via a function that can be included in the sidebar
  • Reports recent comments via a function that can be included in the sidebar
  • Reports top search terms via a function that can be included in the sidebar
  • Outputs a pulse graph of activity on your site or specific stories
  • Highlights search words used by visitors ariving at your site via search engines
  • Lists related posts at the bottom of the current post’s content
  • Suggests posts that closely match the search criteria for visitors who arrive via search engines
  • Integrates bsuite_speedcache
  • Does some stuff with tags


  • The bsuite report consolidates the two uselessly differentiated top stories lists and adds a top movers list.
  • The report also includes a hugely updated Quick Stats section listing today’s current tally and a prediction of the day’s total along with other goodies.
  • The table definitions have been updated and optimized for better performance. Zach contributed some optimizations to the bstat_hitit() function and underlying MySQL queries, and you’ll also find a number of small code optimizations scattered throughout.
  • This version finally creates and configures it’s tables automatically upon activation. You no longer need to visit the plugin’s option screen for this to happen.
  • A fix to address a MySQL error for users running MySQL 5 has been long overdue. It’s in here.
  • Numbers in the reports are now formatted with commas or whatever local format you’ve set MySQL for, using MySQL’s FORMAT() function.
  • As requested, I’ve added a function — bstat_hits() — return just the hit count for a story or for the whole blog.
  • As requested, you can now manually clear the bsuite_speedcache.
  • As prompted, prodded, and cajoled, I’ve finally made a change to report hits to the front page (and other pages without post IDs).
  • I did a bunch of thinking about tags a while ago, and bsuite now keeps an index of tags in a separate table. I’ve got plans to use this for later features, but for now it’s just a curiosity that shouldn’t cause any problems.
  • You can now switch between <tags> or [tags] for compatibility with other plugins (such as noted here) and with WP2’s WYSIWYG editor.
  • The code now properly calls get_settings(’siteurl’) instead of get_settings(’home’) to build the URL for the spacer.gif that builds the pulse graph, fixing the problem where the graph wouldn’t display for some users.
  • Not changed, but at least answered: Eddie commented to explain that ‘–disable-bcmath’ can cause the undefined function errors some people were getting. A later release may incorporate Pramudita’s fix.
  • Also not in this version are the user-contributed tag features I’d gotten so excited about. These just aren’t ready for primetime, but people who want to hack about in alpha-ville will find all the supporting code in there.
  • This list is probably incomplete and in some other way inaccurate. It’s not intentional, I’m just sloppy. Please leave comments with bug reports or corrections, I’ll do what I can to fix them.
  • Finally, I’m now hosting the download on a new server, so it won’t be subject to .Mac’s bandwidth consumption limits.


Update: bugfix release b2v7 available.

  • Download and unzip
  • Place bsuite.php in you wp-content/plugins directory
  • Place spacer.gif in your wp-content directory
  • Log in to your WordPress admin panel and activate the plugin, then visit the new bsuite submenu of the options tab. This will allow bsuite to create its database tables.

    Stats collection will start automatically; you can see the results in the new bsuite Reports submenu of your Dashboard

  • Once installed, be sure to enable the options and consider customizing the look by adding the bsuite CSS to your theme’s CSS (sample CSS here).

In order to view the stats reports reports on your public pages, you’ll need to add the display functions to your pages.


Upgrades from earlier versions of bsuite are easy, just replace the old bsuite.php file with the new one.

If you’re upgrading from bstat (which is so old I was tempted to remove this part of the docs), be sure to delete or deactivate the old plugin before activating the new one. Don’t forget to visit the bsuite submenu of the options tab so you can setup all the new features.


The bstat submenu of the options has a few command buttons:

  • Clear bsuite_speedcache

    The cache improves performance, but can sometimes get stale before its time. This command clears it.

  • Rebuild bsuite tag index

    bsuite maintains its tag index with every story edit. Use this command to bring old-content into the index or if you’ve edited the content in way WP doesn’t know about.


The bstat submenu of the options tab has a few configurable settings:

  • Minimum userlevel to view bsuite reports

    The options are restricted to users at userlevel 8 or above, but you can choose who can view the reports.

  • Output default CSS

    Some of the bsuite functions require CSS styles not found in the average style sheet. This will output default styles.

  • Default pulse graph style

    This sets how values are interpolated in drawing the pulse graph. Experiment with the options to see how they work.

  • Suggest related entries in post

    This will insert a block of links at the tail of each (tagged) post’s content with links to related posts at your site.

  • Tag input format

    Name your style: square brackets or angle brackets / <tags> or [tags].

  • Highlight search words and offer search help

    The first part of this should be obvious, but the real trick here is using those search words to offer other related content from your site to visitors. It works (and looks) a lot like the option above, but the suggestions only appear when search words are detected.

  • Filter incoming search terms using comment moderation and blacklist words.

    Referrer spam is as much of a problem as trackback spam. There are a few tricks in bstat to prevent the problem, but here’s one you can configure. Selecting this option tells bstat to not display search terms that contain words in your moderation list or blacklist.

  • Ignore hits from registered users at or above userlevel

    No author wants to skew their stats just by poking around their own site.

  • Ignore hits from these IP numbers.

    Sites with low traffic may find that activity by authors severely skews the stats tracking. Enter an IP address here to ignore it.

Tag Support

Until WordPress adopts a standardized way to manage tags, we’ll have to deal with things like this.

bsuite recognizes tags in three forms:

  • Any link with a rel=“tag” attribute
  • Any number of single tags like this: <tag>tag name</tag>
  • A block of comma-delimited tags like this: <tags>WordPress, WordPress Plugin</tags>

This appears to make it compatible with a number of existing tag management strategies now in use — including those used by Ecto and SimpleTags.

Tags in <tag> and <tags> tags are mapped to Technorati, but a future version will include an option to set other tag resolvers.

Using bsuite Functions

Though many bsuite features require no coding or modifications to theme files, there are a number of public functions available to display lists of top stories, recently commented stories, recent comments, recent incoming search terms, etc. Most of these functions take similar arguments and output their results in similar ways.

Today’s Stats

  • bstat_todaypop

    displays top stories for today only.

  • bstat_todayrefs

    displays top incoming search terms for today only.

The functions bstat_todaypop and bstat_todayrefs each take the same arguments.

bstat_todaypop({count}, “{before}”, “{after}”);

count is the total number of results to output
before is a string to output before each result
after is a string to output after each result


<h2>Today's Most Popular</h2>
<ul><?php bstat_todaypop(15, “<li>”, “</li>\n”); ?></ul>

Recent Stats

  • bstat_recentpop

    displays top stories for the past x days. This function reveals more useful data on sites with low traffic, but is somewhat slower than bstat_todaypop.

  • bstat_recentrefs

    displays top incoming search terms for the past x days. This function reveals more useful data on sites with low traffic, but is somewhat slower than bstat_todayrefs.

The functions bstat_recentpop and bstat_recentrefs each take the same arguments.

bstat_recentrefs({count}, “{days}”, “{before}”, “{after}”);

count is the total number of results to output
days is the number of days back to look
before is a string to output before each result
after is a string to output after each result


<h2>Incoming Search Terms This Week</h2>
<ul><?php bstat_recentrefs(15, 7, “<li>”, “</li>\n”); ?></ul>

Recent Discussion

  • bstat_discussionbypost

    displays recently commented posts. Each post will appear only once.

  • bstat_discussionbycomment

    displays recent comments (and commenter). Better on sites with lots of community interaction.

The functions bstat_discussionbypost and bstat_discussionbycomment each take the same arguments.

bstat_discussionbypost({count}, “{before}”, “{after}”);

count is the total number of results to output
before is a string to output before each result
after is a string to output after each result


<h2>Incoming Search Terms This Week</h2>
<ul><?php bstat_discussionbypost(15, “<li>”, “</li>\n”); ?></ul>

Special Functions

  • bstat_hits

    displays the current and average daily page loads.

bstat_hits([{template}, [{post_id}, [{today_only}]]]);

template will be filled in with the appropriate values for %%hits%% and/or %%avg%%. If left blank, the default template is %%hits%% hits, about %%avg%% daily
post_id over-rides the detected post ID. Common values for this may include “0” to show stats for index pages, or “-1” to show stats for the entire blog (note that %%avg%% reports inaccurately with a “-1” value here)
today_only returns the count for today (note that %%avg%% doesn’t make much sense here)


<?php bstat_hits('%%hits%% hits, about %%avg%% daily') ?>

prints something like “791 hits, about 10 daily”

<?php bstat_hits('%%hits%% page loads today', -1, 1) ?>

prints something like “5,950 page loads today”

  • bstat_pulse

    displays the “pulse” graph of hits over time.

bstat_pulse([{post_id}, [{max_width}, [{display_text}, [{display_credit}, [{graph_accurate}]]]]]);

post_id is the post_id for the story, usually provided by a WP variable
max_width is the maximum width the graph maw run
display_text (acceptable values: 0 or 1), switch to display stats for total views and average views per day
display_credit (acceptable values: 0 or 1), switch to display “powered by bstat” credit
graph_accurate (acceptable values: 0 or 1), make smooth, accurate graphs or fuzzy (but not inaccurate) graphs


<h3>Story pulse</h3><?php bstat_pulse($id, 525, 1, 1, 1); ?>
  • bstat_hitit

    The hamster on a wheel that makes it all work. It records hits for each page load, and hits for each incoming search term.

This function is no longer necessary, as it is executed automatically via a plugin hook that runs every time the footer is called. Still, it’s around if you have content that you want to track outside that scope.


<?php // this is how it used to work, but it's automated now...
	global $id;
    if (!is_single() && !is_page()) $id = 0;
	bstat_hitit($id, “read”);

note: (be careful of any “curly quotes” that might have been accidentally/automagically inserted in code samples)

Known Bugs

None yet, but I’m sure I’m forgetting something. Report what you find in the comments below.

recommendation system, pulse, plugin, graph, fixes, fix, bugs, bug fixes, bug fix, bug, bsuite, bsuggestive, bstats, bstat, blog pulse, beta, recommendations, recommender, recommending, referrer, related content, search engine highlighting, search term, search term highlighting, sehl, statistics, stats, stats tracking, tag, tag management, tag relationships, tags, usage, wordpress, wordpress plugin

77 thoughts on “bsuite Bug Fixes (release b2v6)

  1. Hi – thanks for bsuite! Everything started working fine for me after I added Robert’s July 25th, 2006 suggestion re apostrophe’s.

    Thought I would pass along a hint too, just in case anyone finds it useful. I wanted to have the stats appear on a single page only, rather than in a sidebar. To to this I just inserted
    the code below into my theme’s index.php right before the line Today’s Most Popular”; bstat_todaypop(15, ” “, ” |”); echo “”;

    echo “Last 30 days’ Most Popular”; bstat_recentrefs(15, 30,” “,” |”); echo “”;
    echo “Last 30 days’ Search Terms”; bstat_recentrefs(15, 30,” “,” |”); echo “”;
    echo “Pulse for post 86”; bstat_pulse(86, 200, 1, 0, 0); echo “”;

    This puts the stats I want on a single post page which I can easily access when I wish. Hope this is useful for someone.

  2. My incoming search terms on the bsuite dashboard are linked to the wrong post, and 90% of my apparent traffic is reported as being direct home page hits, not traffic coming in via links or search. I’m using the Connections Reloaded theme. How can I diagnose this one?

  3. WordPress database error: [Access denied for user ‘yscr_bbSxLF’@’localhost’ to database ‘BlogStuff’]
    CREATE FULLTEXT INDEX bsuggestive ON wp_posts (post_content,post_title);

    It’s too bad to, I’ve been running an earlier version on another blog for many months.

    It might just be WP2.02, I had the same problem earlier today trying to install another stats-related plugin on this same new blog. I’ve been running the previous version of that one for months too.

  4. Only then did I realize that I was running an old version of WP so I just updated to 2.05… go the same error message though.

  5. @BillyG: the database user that WP connects with doesn’t have permission to create indexes. You can either elevate that user’s privileges or manually create the index using a db user that does have privs.

  6. has the bstat_refsforpost() function got discontinued [ without notice??!! ]

    i see the following in my b2v6 code (line 593):
    // Display all search terms for a particular story
    function bstat_refsforpost($post_id, $before, $after, $return = 0) {
    // end function bstat_refsforpost

    this function was the main reason why i am using bsite. i feel many others will be needing this function aswell. why is it being discontinued?

    i have copied the function from the older version though. if any one needs the old code:

    // Display all search terms for a particular story
    function bstat_refsforpost($post_id, $before, $after, $return = 0) {
    global $wpdb, $bsuite_tables, $tableposts;

    $request = “SELECT ‘$post_id’ AS post_id, a.ref AS title, SUM(a.hits) AS sort_order, CONCAT(‘ (‘, SUM(a.hits), ‘)’) AS note
    FROM $bsuite_tables[bstat_refs] a, $tableposts b
    WHERE a.post_id = b.ID
    AND issearchengine = 1
    AND a.post_id = $post_id
    GROUP BY a.ref
    ORDER BY sort_order DESC
    LIMIT 150

    return(bstat_reporter($request, $before, $after, 1));
    echo(bstat_reporter($request, $before, $after, 1));
    // end function bstat_refsforpost


  7. The bsuite graph covers up the basic WordPress stats just above the WordPress logo and part of the WP logo itself at the borrom of the Dashboard| bsuite page when viewed at 800 x 600. Unchecking both accurate and fuzzy does NOT seem to turn off the graph. I can live without that part – what it covers up is more useful to me. How do I disable the graph completely?

  8. Pingback: EdVentures in Technology » WordPress seeks your input to improve their app

  9. Hi, Casey, I’m running WP 2.1.1 and SimpleTags along with bsuite … but I’m not getting the bsuggestive related posts offering. Is there still a conflicted between SimpleTags and bSuite?

    Is there a pop call I can explicitly reference in my page file?



    [tags]Tags SimpleTags bSuite WordPress[/tags]

  10. @Rich:

    The “related posts” feature has to be turned on in Options > bsuite. It _should_ work with simpletags-style tags, though you may not want to run both at once.

  11. Pingback: Wordpress 2.1 vs New Blogger » Walker News

  12. I’ve implemented bsuite release b2v6 in wordpress v2.1.1.

    It’s great! But, I am unable to see bsuggestive links of related posts. Is there any special configuration, other than the bsuggestive check box in option page of wordpress admin?

  13. Hi casey,

    yes, i did read the instruction, and has each my post appended with technorati tags link rel=”tag”.

    there are at least 2 posts with similar topic and exactly same rel=”tag” keyword. But, none of these 2 posts has “related posts” link.

    please help.

  14. Good day Casey,

    I’m still not getting the related post links in my blog, that running wordpress 2.1.2. can you please help me to rectify?

    Many thanks.

  15. Hello. Can someone please help to get bsuggestive to work on my wordpress 2.1.2 version? I have embedded some technorati tags in bottom of each posts, for example something. In addition, I’ve enable the bsuggestive option in Wordpres option page as per instruction.

    However, I am frustrated as the related post links are not seen. I am not sure I’ve did it wrongly, as I don’t see my post appears in when I follow the tag i added for the post.

    Many thanks,

  16. Hi ..
    I downloaded the zip file yesterday and installed it to my blog which is WP ver 1.5.2 (I tried offline first via apache server installed in my laptop). Looked like the script failed to generate (create..) tables .. or something like that, while when I tried with WP 2.1.2 it worked like a charm..

    Cheers, keep it up

  17. I am having the same error as Dave (post number one) where I get a blank/white screen after activation of the bsuite plugin.

    Had to remove bsuite from the plugin folder in order to get back into any WP screens.

    I have WP version 2.1.2 with one other plugin running ok.

    [tags]install bsuite blank[/tags]

  18. Dude,

    I have a couple fixes for your bsuite plugin, but I can’t find either a page for it, or your contact info. Get back to me so I can ship the plugin via e-mail.

  19. Pingback: NOUMENON :: Art, Ideas, Culture & Capricious Opinion » Blog Archive » bsuite Tags Where You Want ‘em

  20. Pingback: bsuite Bug Fixes (release b2v7) «

  21. Pingback: » Blog Archive » has hit a milestone!

  22. Pingback: WP Plugins DB » Plugin Details » bsuite

Comments are closed.