bbPress

Simple, Fast, Elegant

bbPress 0.9 notes for plugin developers

March 6, 2008 5:49 am — Development — Sam Bauers

Plugs!

There are a few changes in 0.9 which plugin developers need to be aware of. So here are some notes to help you get your plugins running under the new release.

(more…)

The future for bbPress

January 25, 2008 1:47 am — Community, Development — Sam Bauers

Great Scott!

Most of those who follow the tech-blog-o-sphere* will be aware of the recent financial news regarding Automattic, the company that more or less stewards bbPress’ production.

For the rest of you here are some links that cover the story.

Some people may be wondering what this news means for bbPress. Well, for a start this funding has already impacted on the project as it made my full-time employment with Automattic possible three months ago when the arrangement was in it’s early stages. But more importantly it now allows Automattic to have the financial security to back bbPress into the foreseeable future.

We have some awesome things in the pipe including improvements to the bbPress core, the bbpress.org website and, in the not too distant future, the launch of a hosted community service by Automattic based on bbPress.

In the meantime, we will be ramping up the pace of development and attempting to bring out some of the new features that have been on the “to-do” list for far too long. Features which we hope will help to differentiate bbPress from the crowd and make it a truly useful tool for building online communities.

* NB: Not an actual word

BB_Query Class and custom bbPress views

September 27, 2007 12:35 am — Development — mdawaffe

With the introduction of the new BB_Query_Class in bbPress 0.8.3, the old method of adding custom “views” to bbPress has been removed. You should no longer directly manipulate the $bb_views array, nor does the bb_views hook work.

To add a view, you should instead use a new function: bb_register_view(). Also available is bb_deregister_view() for removing the default views or views added by other plugins.


function my_plugin_views() {
/*
  bb_register_view(
            $view_slug,
            $view_title,
            $bb_query_argument_array
  );
*/

  bb_register_view(
            'more-than-5',
            'Topics with more than five posts',
            array( 'post_count' => '>5' )
  );

  bb_register_view(
            'old-timers',
            'Topics started before 2005',
            array( 'started' => '<2005' )
  );

  // Remove default 'Topics with no tags' view
  bb_deregister_view( 'untagged' );
}

add_action( 'bb_init', 'my_plugin_views' );

If you really need more complicated queries, you have the following filters at your disposal, just by registering your view in the above fashion (assuming the $view_slug is “my-view”).

  • bb_view_my-view_distinct
  • bb_view_my-view_fields
  • bb_view_my-view_join
  • bb_view_my-view_where
  • bb_view_my-view_group_by
  • bb_view_my-view_having
  • bb_view_my-view_order_by
  • bb_view_my-view_limit

If that sounds complicated, it probably is :) Most plugin developers will never have to do much besides filter a join or where here and there.

WordPress 2.3 is out

September 25, 2007 1:51 am — Development — mdawaffe

WordPress 2.3 is now available.

I mention that because the current version of bbPress (version 0.8.2) is not compatible with WordPress 2.3 if you are loading both scripts at the same time. If you’re not loading both scripts at the same time, everything is fine.

A new version of bbPress will be coming out in a day or two as soon as we get done testing it, and that version will fully compatible with the latest version of WordPress once again.

Searching and the BB_Query class

June 29, 2007 5:17 pm — Development — mdawaffe

bbPress has twenty or so functions that select groups of topics or posts from the database. Some of them do very specific things, and some of them do something only slightly different from another such function.

Maintaining this large group of functions and keeping them all consistent was beginning to become a nuisance. Additionally, it was annoying to have either to write a whole new function or to hack filters into and onto an existing function every time a new database query was needed.

To help alleviate both of these problems, the next version of bbPress will come with a BB_Query class, which all of the above referenced functions will use.

Details and Cool new user features

bbPress 0.8.2 and FOUND_ROWS()

June 21, 2007 11:54 pm — Development — mdawaffe

bbPress 0.8.2 introduced a new way of counting how many pages worth of information there were to display (how many pages worth of content, for example, there are to display in a user’s profile): MySQL’s FOUND_ROWS() function. It works very well for most bbPress sites.

It cripples large sites.

(more…)

bbPress’ time functions no longer insane

February 8, 2007 10:57 pm — Development — mdawaffe

Timezones

Historically, bbPress has dealt with time in a… shall we say “interesting” manner. Without going into technical details, bbPress constrained you, the person installing bbPress, to set it’s internal timezone to match exactly that of the server it was running on.

That’s ridiculous.

What if you lived in Brisbane, but your servers were held captive in Cleveland and set to GMT? I’ll tell you what if: only after lots of trial and error were you able to get rid of that strange “-1 years ago” bug seen everywhere on your site. But then you were stuck at some arbitrary timezone.

With bbPress 0.8, all that has changed. You can set bbPress’ timezone to anything you like completely independent of where you are and where your server is.

But that’s not good enough, you cry! You want your users to be able to set their own timezones too! Well, bbPress doesn’t do that, and may never, but a plugin can and does! See the “proof-of-concept” User Timezones plugin.

Template Functions

Additionally, theme designing and tweaking is now much easier with respect to time template functions like bb_post_time(), topic_time(), and topic_start_time().

  • By default, these functions output time formatted like “7 hours” as in “7 hours ago”.
  • You can specify a different format by using a PHP date format string:
    bb_post_time( 'F j, Y, h:i A' )

    -> “February 8, 2007, 10:57 PM”

  • A lot of bbPress’ default templates used to do strange things like
    bb_since( strtotime( bb_get_post_time() ) )

    or something equally heinous. No longer. All the default templates now use the much more pleasant method described above. If you based any custom templates off of the old default templates, they will probably still work since the changes made were almost completely backward compatible. If you run into any problems, remove from your templates any mention of strtotime(), bb_since(), and bb_offset_time() as the bits you need from those functions should now work automagically.

  • For you plugin developers, you can also easily grab the Unix timestamp: bb_get_post_time( 'timestamp' ), and the MySQL date: bb_get_post_time( 'mysql' ).

Much more pleasant :)

Some up and coming features

February 1, 2007 6:09 am — Development — mdawaffe

bbPress has seen some pretty interesting development over the past weeks. Just to keep people in the know, and since many were expecting bbPress 0.80 to come out a couple weeks ago (we’re still learning here :) ), here’s a short list of some new features that will be in the next release.

  • Better support for right-to-left languages.
  • Some better backend support for search queries.
  • Removal of the topic_resolved column from the database. No more “this topic is not a support question” strangeness for forums that aren’t support forums. Those people that want to keep such functionality around will be very pleased with Aditya’s Support Forum plugin.
  • The ability to delete forums. (No!) Yes!
  • Tags that are multibyte aware (you’ll be able to tag in Japanese).
  • Multiple theme support. You’ll be able to upload a bunch of themes and select which one you want from the Admin panels.
  • A more pluggable database class and user system.
  • Anywhere-you-want-them plugins directory, templates directory, and config.php. This is pretty nice; you’ll be able install a completely “clean” copy of bbPress in, for example, a directory named public_html/forums/ and have your templates stored in public_html/templates/, your plugins stored in public_html/plugins/ and your config.php file in public_html/config.php. None of your custom stuff ever has to be in bbPress’ public_html/forums/ directory, so upgrades will be a snap.

Of course, we’re still working out some bugs and have a few more important things to get done before the next release, but that’s a preview of things to come.

New Mailing List

February 1, 2007 5:48 am — Development — mdawaffe

For those of you interested in keping closer tabs on bbPress development, we now offer a new bbPress Trac Mailing List. Subscribers to this “read-only” list will receive an email every time a ticket on bbPress’ development center is changed. I tried generating an RSS feed for such changes, but my Trac-fu is pretty poor. So, email it is.

The original bbPress Development list is still around, of course, for discussions and ideas.

Sign up for both!

bbPress options API

January 6, 2007 8:16 pm — Development — mdawaffe

In the previous post, I alluded to a place to store options (basically, any arbitrary data) in the database. Plugin developers shouldn’t try to access that data directly; we’ve got an API for you.

bb_get_option( $option_name )

This one function grabs data from all the different places bbPress uses to store such data: hardcoded data, “softcoded” data, and data stored in the database.

First, the function checks to see if $option_name corresponds to some hardcoded value like version, language, or text-direction. If $option_name doesn’t match an hardcoded value, it looks to see if it matches what I call a “softcoded” value. These are the names of the options stored in the global $bb variable such as domain, path, akismet_key and so forth. Finally, if it still hasn’t found anything, it queries the database for $option_name.

It returns the value of the option filtered through the filter bb_get_option_{$option_name}. (So if you asked for the option named “blue”, you could filter the results with the bb_get_option_blue filter.)

bb_get_option_from_db( $option_name )

If you want to bypass all the hardcoded and softcoded data queries that bb_get_option() performs and go straight to the database, use this function. Its results are filtered through bb_get_option_from_db_{$option_name}. In conjunction with the bb_get_option_{} filter, a plugin could use this function to override softcoded data with data from the database.

NOTE: bb_get_option() calls bb_get_option_from_db() when it decides to grab data from the database. So both bb_get_option_{$option_name} and bb_get_option_from_db_{$option_name} may be run on the same result.

bb_update_option( $option_name, $value )

Updates (or adds) the option named $option_name with value $value to the database. You can store any type of variable except NULL.

NOTE: Option names are unique in bbPress.

bb_delete_option( $option_name, $value = '' )

Deletes the option from the database. If you want a sanity check, you may include the value of the option. $value has no other use here, however, since option names are unique; bb_delete_option( $option_name ) works just fine.

bb_cache_all_options()

Options are not loaded into cache by default when bbPress starts up. Each option is cached only after it is queried for the first time; if you grab several options from the database, you will query the database once for each option. This function caches all options from the database in one large query. You may find it increases performance for some applications.

Next Page »

Code is Poetry.