quaker, that's great that you got your site working without wordpress. i'm trying to make it work with it.

elbekko, that guistyles site doesn't combine wordpress and punbb, it just has a punbb thread about wp.

I've received some emails as a result of this posting indicating that other people are having the exact same problem as me when integrating with WordPress and also Coppermine. I have not been able to find a solution.

So.. has anyone successfuly integrated WordPress 2.0 and PunBB 1.2.11? They're certainly two very popular, open-source projects, and I'd be very interested to know if they've been integrated without running in to this error.

I haven't modified the code at all, but I now have some commented out code in that function that I added myself. It's referring to the code that starts like this:

// Fetch guest user
$result = $db->query('SELECT

Again, the problem is that the $db object doesn't seem to be scoped inside of the function even though it is being defined as global. If I print_r($db) just before the function, it has properties, but inside of the function it doesn not.

Smartys wrote:

Does Wordpress use a $db variable that interferes?

No, its database layer is stored in $wpdb

I'm building a site that uses the pun_ functions across the entire site to maintain users while outside of the forum. I'm doing this by including the following code in the header of every page on my site:

define('PUN_ROOT', $_SERVER['DOCUMENT_ROOT'] .'/forum/');
define('PUN_QUIET_VISIT', 1);
require(PUN_ROOT . 'include/common.php');

This has worked great everywhere until I tried to include it in the header of a WordPress template, and received the following error:

Fatal error: Call to a member function query() on a non-object in /forum/include/functions.php on line 122

What I've found is that, for some very strange reason, the variables being made global at the top of the set_default_user() function are not actually becomming global and thus the query() method of  the $db object does not exist at that scope. If I reinstantiate the $db object inside of the function, that particular error goes away.

Any idea why this is happening?

riki1512 wrote:

Seems 'global' has no effect in my code !?

I am having the same problem! I am trying to integrate with WordPress, and not is seems that the objects being made global in functions.php are not actually global.

I would love it if PunBB would rename it's $db object to something like $pbb_db to avoid possible conflicts.

I am having the same problem integrating with WordPress. After commenting out the unregister_globals() function I am still getting the non-object error.

For some reason the $db object is not available globall in the set_default_user() function even though it defined as global.

Would love some help with this.

I am having the same problem. After commenting out the unregister_globals() function, I get this error:
Fatal error: Call to a member function query() on a non-object in /Users/javan/Sites/2point0/forum/include/functions.php on line 113

It's seems the $db object, even though it is being declared as global within the set_default_user() function, is not available.