1 (edited by Light Difference 2005-12-20 22:05)

Topic: Having trouble integrating PunBB and WordPress

Hi,

I'm having a slight problem integrating Wordpress 2.0 RC3 and PunBB. First off, I got an unregister_globals(); function collision for Wordpress, and for the time being I've commented it out. It was located on line 1034 in include/functions (with comments). It would be nice if someone could rename that function pun_unregister_globals(); or something similar. Now, oddly, Punbb is failing to initiate the database class in functions.php on line 110 (
Fatal error: Call to a member function query() on a non-object in /Library/WebServer/Documents/macsuburb/forum/include/functions.php on line 110) , which is this.

$result = $db->query('SELECT u.*, g.*, o.logged FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error());

I don't know if it's something on my part or PunBB's, so if anyone knows anything it'd help.

Thanks.

2

Re: Having trouble integrating PunBB and WordPress

Hey! Having the same problem here with my script, altough i'm trying to get it going with MediaWiki. I read in another thread about this topic that $db has to be global. Where exactly should i make it global, and how do I do that in a proper way?

global $db;

?

My scripts: wiki/*.php call functions in > wiki/extension/auth_punbb.php > includes common.php and so on.

Anyone have ideas? Thanks! smile

3

Re: Having trouble integrating PunBB and WordPress

Hey any links with WordPress integration with PunBB ?

4

Re: Having trouble integrating PunBB and WordPress

Take a look at this thread: http://punbb.org/forums/viewtopic.php?id=8373

5

Re: Having trouble integrating PunBB and WordPress

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.

Re: Having trouble integrating PunBB and WordPress

i'm trying to run punbb functions from within a wordpress theme and i'm getting this error:
Fatal error: Call to a member function on a non-object in /home/.turgo/newathens/newathens.org/forum/include/functions.php on line 110

due to this code:
define('PUN_ROOT', './forum/');
require PUN_ROOT.'include/common.php';

if i use this code:
define('PUN_ROOT', './forum/');
global $db;
require PUN_ROOT.'include/common.php';

i get this error:
There is no valid language pack '' installed. Please reinstall a language of that name.

it's very odd - and i'm not sure what to do. i'm running the latest version of punbb and wordpress - and i do have the language pack English installed. and i checked my punbb config and it says i'm using english. if anyone has any ideas, i'd really appreciate it

Re: Having trouble integrating PunBB and WordPress

I'm still not able to get this working. It seems that I'm loading the punbb functions properly, but it's just not working as expected. Please let me know if you've done this successfully and might be able to help. Thanks much.

8 (edited by trevor 2006-09-19 16:21)

Re: Having trouble integrating PunBB and WordPress

Anybody...? Bueller...? smile

I'm also wondering if there's a chance of getting the unregister_globals() function renamed so as not to conflict with Wordpress. I know that's an odd request, but it's going to make it impossible to link the 2 programs without changing the core files of 1. Is there a place to leave tickets? I don't see how to log into Trac.

Re: Having trouble integrating PunBB and WordPress

... Suddenly, the include is working... ! I'm not sure why, though, which is a bummer. Anywhoot...!

If somebody reads this anyway - is there a way to put in a "formal" request to get unregister_globals() renamed to something like punbb_unregister_globals() or what have you? I'm editing the Wordpress wp-settings.php file to avoid the clash, but it would be nice to not have to do that.

Re: Having trouble integrating PunBB and WordPress

I can see the need to change it, but why should PunBB have to do it as opposed to Wordpress? tongue
I'd suggest making a new topic in Feature Requests

11

Re: Having trouble integrating PunBB and WordPress

Ha! http://punbb.org/forums/viewtopic.php?pid=77662

Thanks, Rickard!

Umm... So, I've managed to make a page to log into PunBB from within a Wordpress theme. This is not so terribly hard, but it wasn't exactly "easy", either. The next step, of course, would be to make it also log you into Wordpress. Before I get that far, I thought I'd share the code.

If someone is interested in this and knows what's what, please have a look and let me know if I'm doing something in a silly or otherwise non-smart way:

http://www.newathens.org/files/punbb_wp_login.txt

Clearly, this doesn't take into account password resets, etc, and bad passwords are dumped in a funny way. What I'm trying to get done is logging into PunBB cleanly, and then I'll add in the rest.

Perhaps, for example, I don't need to leave in the stuff updating the status of the user, etc. I figure it's not a bad idea to leave it in there, though. I could, I suppose, try and sneak another feature by Rickard and see if he'd turn all of the actions taken at login into a function - that way, I wouldn't need the code in here. I dunno, I'm just rambling now. I'm working on logging into Wordpress AND PunBB now, so I'll post my progress on that when it's functional.

P.S. - If you'd like to use this code, just make a "login.php" file in your current Wordpress theme directory, and then make a Page which uses that "template". I made a Page called "Login" and left it blank, telling it to use Login as the template.

Re: Having trouble integrating PunBB and WordPress

I'd suggest Wordpress change it as well, that was my only point tongue

As for the status changing code, I'd say it is important. Otherwise, a user who only logs in that way will be marked as unverified even when they are verified.

13

Re: Having trouble integrating PunBB and WordPress

Thanks Smartys. You're right, I'll put in a ticket on Wordpress to change that function, too. I was just thinking it'd be easier to get something changed in PunBB than the other way around. Not that I don't love Wordpress, but I don't think I've ever gotten a ticket through there.

I'll leave that stuff in I s'pose. I'm just trying to be careful and do things the best way possible - e.g. avoiding duplicate code and overly complicated stuff. Thanks for the reply. I post back here when I make more progress.

14

Re: Having trouble integrating PunBB and WordPress

I solved my issue with including the punbb functions. Here's the code, in case anybody else runs into this problem:

define('PUN_ROOT', './forum/');
global $db, $pun_user, $pun_config;
require PUN_ROOT.'include/common.php';

The problem was not having the $db, $pun_user, and $pun_config variables globalized.