[bbDev] Include bb from WP

fel64 at loinhead.net fel64 at loinhead.net
Mon May 28 17:08:42 GMT 2007


Hey,

I was trying to make a wordpress plugin to achieve integration between
blogposts and topics - so that each new blog post would create a topic,
the replies would be shown instead of comments and you could 'comment' as
before but it would be entered as a bb post in reply to the associated
thread instead. To do this, I think using the bb API would be best, to
create and edit the topic for example when making the blog post. Including
bbPress at different stages in the WP plugin produces strange results, and
I wonder how they could be resolved.

Including in the main body of the plugin code loads it just fine and it
works perfectly, except that that means bb is loaded all the time when
it's mostly entirely unnecessary. I used
require_once('path/to/bb-load.php');
Including bb in a function called by a hook or filter always causes an error:

> Fatal error: Call to a member function get_row() on a non-object in
D:\xampp\htdocs\forums\bb-includes\functions.php on line 1224

which I believe is because $bbdb is never created for some reason. This
also happens if the hook is 'init'.

I went through wp-settings.php and required bb systematically in different
places. It worked at any point after requiring general-template.php (line
153), including after do_action('init');, which makes no sense to me at
all.

Is there a solution? A reliable way to load bb in functions called by
hooks or filters?

Cheers,
Felix





More information about the bbDev mailing list