Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress’ time functions no longer insane

Published on February 8th, 2007 by Michael Adams (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 🙂

bbPress 0.8 “Desmond” Released!

Published on February 8th, 2007 by Michael Adams (mdawaffe)

After some “last minute” bug squashing, here we are: another new bbPress release ready for download. bbPress “Desmond” 0.8.

In addition to some features we already mentioned on the blog (here’s a few to recap):

there’s a couple new ones that are among our most frequently requested:

  • Better timezone support; You’re no longer restricted to showing all your times in the timezone of your server (what an odd requirement that was)
  • Whitespace preservation of `backticked` <code> blocks.

Upgrade Note: Your custom templates and stylesheets must now be placed in a sub-directory of my-templates/ rather than in that directory directly. Try putting your files in something like my-templates/my-hot-theme/ then selecting your theme from your bbPress’ Presentation Admin panel.

To get into the nitty gritty about what’s changed, here’s a list of tickets closed and two of code changed [2] (I couldn’t get trac to show them all on one page there’s so many!).

Translators can download the POT file for bbPress 0.8.

Some up and coming features

Published on February 1st, 2007 by Michael Adams (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

Published on February 1st, 2007 by Michael Adams (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 0.75

Published on January 15th, 2007 by Michael Adams (mdawaffe)

Because of a PHP bug, we recently discovered that a small number of bbPress users are prone to a security vulnerability. Only users of certain versions of PHP and with certain server configurations are at risk, but encourage everyone to upgrade to the newly released bbPress 0.75 regardless.

Get downloadin’!

To see what’s new, check out the lists of tickets closed and code changed.

bbPress Plugin Browser

Published on January 9th, 2007 by Michael Adams (mdawaffe)

After lots of hints and hushed voices, the bbPress plugin browser is here.

We’re offereing this up as a centralized source of bbPress plugins. Hopefully, for all us users, that will mean one-stop shopping when looking for plugins.

And for you developers, anyone can host their plugin there. We keep track of comments, ratings, and download stats for you. You even get your own little corner of the bbPress plugin development center (a trac install) for you to keep track of bugs, tickets, changes and versions of your plugin.

Many thanks go out to Aditya for helping me test and debug the site, and to Stefano and Trent as well for early adoption.

bbPress options API

Published on January 6th, 2007 by Michael Adams (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.

bbPress 0.74

Published on January 6th, 2007 by Michael Adams (mdawaffe)

After a month of waiting, bbPress 0.74 is finally available for download. Even if it did take a while, we’ve fixed a several important things.

Aditya has a great overview of the changes, but here’s a few of the bigger ones.

  1. init hook has been changed to bb_init for better compatibility with WordPress.
  2. When users are deleted, they’re really deleted now.
  3. Somewhat simpler installation procedure. When installing, you’ll also be informed if any of those little configuration variables are incorrectly set.
  4. A place to store options in the database! Woo!

We’ve got some slick new features we’re working on for the next release (did someone say “themes”?), so stick around….

In the meantime, read on for some more technical details about this release.

Read more →

bbPress International

Published on October 28th, 2006 by Michael Adams (mdawaffe)

With bbPress 0.73 out, bbPress is much better equipped to handle localization to whatever language you speak.

We’d like to encourage such localization by offering a centralized resource for localization files, support and anything else needed by the international community.

Please leave a comment here to let us know what language you speak (and fill in your email!) if you’d like to get involved. (We have some pretty heavy moderation in effect; don’t worry if your comment doesn’t appear right away.)

And apologies ahead of time; I only speak English. Italian used to be a second language of mine, but that was tanti anni fa.

bbPress 0.73

Published on October 27th, 2006 by Michael Adams (mdawaffe)

After a couple of weeks of kicking the tires, we’ve decide we’ve fixed enough bugs to put out a new version of bbPress. So here it is: 0.73, the latest in the bbPress “Bix” series.

The changes in brief:

  • Improved rewrite rules generation
  • Template cleanup
  • Much better support for non-English forums including support for right-to-left languages
  • Improved installation
  • Even better integration with other software
  • And, of course, a small security fix

More detailed information about the changes can be gleaned from the tickets we fixed and the code we improved.

Download, and Get your bbPress on, everybody!

Learn more about 0.73 »

Skip to toolbar