Skip to:

Re: Hack: bb replies as wp comments; using bb API?



Got a problem on my hands. I’m trying to simplify a lot of things by require’ing bb-load.php and then using the bb API. However bbdb loads with a fatal error if I do this when wordpress has fully loaded, but it works perfectly fine if I require bb-load when the plugin is run.

What I mean is require( 'path/to/bb-load.php' ) works fine if placed anywhere inside the main code of the plugin. If I call it using the wp hook init it no longer works, nor does calling it by other hooks (that I’ve tried) or through function calls in templates and the like.

I went through wp-settings.php and require’d bb-load systematically until I found that it only worked once wordpress had loaded general-template.php (line 153). It worked from any point onwards, including after do_action('init'); (which I don’t understand at all). Using the init hook in my plugin to require it does not work.

I suspect this means that the init hook in wordpress maybe does something or other, then loads plugins, then does something else that stops bb being included, then runs any other funtions registered with the init hook – but my wp mojo is not impressive. I tested this with all other plugins deactivated.

The output if bb-load is required too late in the code:

Fatal error: Call to a member function get_row() on a non-object in D:xampphtdocsforumsbb-includesfunctions.php on line 1224

That makes me think bbdb is not created, but I can’t see why it wouldn’t be.

Can someone help me with this please? I’d much rather use the API than duplicate functions.

Skip to toolbar