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.
For developers and plugin authors, this means it’ll will now be really easy to query the database for posts and topics based on whatever arbitrary criteria is needed. For users, the following couple paragraphs will be boring, but see the news below 🙂
Example
As an example, the following code will select all the topics written by mdawaffe in June of 2007 and having the “bbPress” tag and will sort those topics by their start time.
$topic_query = new BB_Query( 'topic',
array(
'topic_author' => 'mdawaffe',
'started' => '2007-06',
'tag' => 'bbpress',
'order_by' => 'topic_start_time'
)
);
$topic_query->results; // Here's the array of topics the query returned.
Both the incoming parameters and the SQL query that the class generates are highly filterable (in a way that’s backward compatible with the current version of bbPress), so further customization should be easy. Also, the BB_Query
class can automatically handle pagination, caching and more, so you can relax and get on with more interesting things.
New feature: better search
In the end, though, we write code for users, not for developers; we want the user experience to be as pleasant as possible. With all these new bells and whistles, users get some pretty cool new features.
The default theme will now let you constrain your search to an individual forum (and adding that ability into other themes will be super easy). Adding extra constraints (like searching by tag or author) will be easy too.
In the admin section, you can search both topics and posts by a number of criteria.
Next stop… Pingbacks. (sshhh! It’s a secret!)
I am relativity new to bbPress (been a WordPress user for about 10 months) and I am so impressed with the great quality of these boards:
In the end, though, we write code for users, not for developers; we want the user experience to be as pleasant as possible.
Keep up the great work guys, we appreciate it!
[…] bbPress是wordpress新近开发的论坛程序,顾名思义,是bbs+wordpess的结合体,所以它还带着一些wordpress的影子,有一些挺有趣的特性,比如tag,RSS feeds,Akismet spam,Ajax交互。 […]
[…] new version is finally here, and ready for download! The biggest news is better search and compatibility with WordPress 2.3, but it also fixes a lot of […]