1 (edited by Jasoco 2006-01-19 00:50)

Topic: Having tons of trouble integrating into my site (WP)

I want to take it a piece at a time.

First step I want to do it place into my template the code to connect to the punBB database then recieve information about the forum, display a login section (Into the page itself, not a link to another page. But if I have to, a link to another page where you can login then return to the main page of the site.) in the sidebar, display other information about threads and new users and stuff.

I can do the bulk coding stuff, but I'm having trouble getting started.

I've followed that "How to" on the documentation page:

But the first problem I ran into was requiring the common.php file. I typed:

define('PUN_ROOT', './geekpub/');
require PUN_ROOT.'include/common.php';

to start with but it gave me errors:
Parse error: parse error, unexpected T_STRING in /home/jasoco/public_html/wp-content/themes/Jasoco/header.php on line 2
After playing around, I find that it's not accepting "./geekpub/" as the path. I hard code the actual path to the file into the "require" line and end up with:

define('PUN_ROOT', '/home/jasoco/public_html/geekpub/');
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);
echo PUN_ROOT;
require PUN_ROOT.'include/common.php';

But it doesn't work. I get:
Fatal error: Cannot redeclare unregister_globals() (previously declared in /home/jasoco/public_html/wp-settings.php:4) in /home/jasoco/public_html/geekpub/include/functions.php on line 1034

The "echo" line is for debugging. It shows that the PUN_ROOT variable is being set correctly. (When the page is loaded, it prints the variable right before the error appears which shows that A) the error occurs after the echo line and B) that it's the Require line causing problems.

If I comment out the require line it loads fine. The page shows normally (With the echo'd PUN_ROOT printed at the top of the page.)

So you can see my problem is clear. This code is contained in my WordPress theme's "header.php" file. This file is contained under "/wp-content/themes/Jasoco/". It's also the first line at the top of the outputted code.

I tried putting my new punBB code in other files including WP's own index.php file (Contained at the root of the site.) but it does the same error anyway.

I must be doing something wrong.

Any help?

Edit: Apparently the forum software includes function with the same name as a function in WordPress. unregister_globals()

ITo remedy I tried renaming all occurrences (All two of them) from unregister_globals() to unregister_globals_pun() but that didn't work. It gives me a new error: Fatal error: Call to a member function on a non-object in /home/jasoco/public_html/geekpub/include/functions.php on line 110
But apparently this function isn't needed by the actual forum because even with that function renamed, the forum still works fine. So obviously unregister_globals() is only used for integration purposes.

Re: Having tons of trouble integrating into my site (WP)

Since you're including PunBB's common.php from Wordpress, there is no need for PunBB to run unregister_globals. You can safely comment out the call to unregister_globals in common.php and comment out the whole function in functions.php. That should do it.

"Programming is like sex: one mistake and you have to support it for the rest of your life."


Re: Having tons of trouble integrating into my site (WP)

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.