1 (edited by ihuston 2005-08-10 21:11)

Topic: Wordpress plugin to post to PunBB

I'm currently using WordPress as my blog and PunBB as a forum on my site and having read these discussions, I decided to try to give something back and make a wordpress plugin that crossposts a new topic to punbb.
I've been messing around with it for a while, and with a lot of inspiration from the NP_PunBB plugin mentioned here, I finally cobbled something together.

[EDIT]
Download the plugin by right clicking and saving this link.
A Zip archive of the file is available here.
[/EDIT]

It really is very basic at the moment, but adds a WordPress options submenu, where all the configurable variables can be changed. There is no checking of userid or permissions yet, and I take no responsibility for anything that might happen, so please back up your wordpress and punbb databases.

To install the plugin place the file ih_wp2punbb.php in the wp-content/plugins directory of your wordpress install. Then activate it in the Plugins menu.
If you want a separate comments forum then create it now in punbb. Access the configurable options in Wordpress in the WP2PunBB menu under Options. The username and userid must be for the same user in punbb. Also you need the full file path to the punbb installation, e.g. /var/www/httpdocs/forum/ . The forum id can be found by looking at the link on the main punbb page (viewforum.php?id=#).

To add a link to the forum on each wordpress post add the following to your main template page where you want the link:

<?php ih_add_comment($post->ID); ?>

Current Problems:
There is currently no way to batch add old posts into the forum, only new posts are added.

Security and checking of permissions is non-existent.

Due to some function name clash or other reason, I can't get the forum to update with new values for last post etc.  This means that even after a blog post is added to the forum it won't show up in the main index. It will be in the comment forum index though.

Editing wordpress posts will not change the post in punbb.


This is pretty much my first post here, so please be kind! As mentioned in the file comments, the code borrows a lot from the NP_PunBB plugin by Radek Hulan, Bert Garcia and Rickard Andersson, so thank you to them.

2

Re: Wordpress plugin to post to PunBB

Hey, that's great.

More users for PunBB, thanks for taking the time.

Re: Wordpress plugin to post to PunBB

Fatal error: Call to undefined function: add_action() in /home/httpd/vhosts/ianhuston.net/httpdocs/files/ih_wp2punbb.php on line 169

:<

Re: Wordpress plugin to post to PunBB

If you left click on the link it will try to run the file, right click and save as. Sorry, I should have made that clearer.

A Zip of the php file is here.

Hope that works.

5

Re: Wordpress plugin to post to PunBB

Here's a fantastic article and code for integrating WP and PunBB together

http://www.liewcf.com/blog/archives/200 … wordpress/

Re: Wordpress plugin to post to PunBB

As all wordpress plugins coded in the php 4 way, I get a "cannot redeclare" error when trying to access the admin panel for the plugin :

Fatal error: Cannot redeclare ih_wp2punbb() in E:\Homepage\Psykotik\blog_test\wp-content\plugins\ih_wp2punbb.php on line 12

I don't have any clue what would is exactly the difference with php 5, but when I test the plugin with php 4 all works like charm.

By any chance... would you release a php 5 version ? smile

Re: Wordpress plugin to post to PunBB

Well, I hope the plugin is still supported... or will be again smile

Installing again php 4 (since my previous problem is still there), I've been playing a little bit with the plugin.

And a strange behaviour occur : the creation of the new punbb subject works like a charm, but there is no update (I've seen something is inteded in the code) and the most annoying... it doesn't create the row into {$wpdb->postmeta}. The result is I can't call back directly the punbb subject from the blog page...

8 (edited by trevor 2005-10-05 06:31)

Re: Wordpress plugin to post to PunBB

I can't get this thing to work. It seems to create the topic OK, but creating the post fails... I'm working on it, but if anybody else can have a look, that would be great...

The main problem I see is that adding a "post" seems complicated. I'm not sure if there is an easy way to use the $db class to simply add a post to a particular forum. Looking at this plugin, which has a function to add a post, it seems there is a lot to it (http://www.happypoet.com/hackery/wphpbb/).

Is there a function we can use to add a new post, and possibly return the ID of that new post?

Re: Wordpress plugin to post to PunBB

I just want to bump this a bit, sorry.

Does anyone know of an easy way to add a Topic via a function or something? Right now, it looks like you have to add a Topic, then a Post, then make some changes to the Topic, and possibly the user.

Is there anything easier?

10

Re: Wordpress plugin to post to PunBB

For those who experienced problems with Ian Huston WP2punBB plugin:

At the and of the script, in the <h2> tag an apostrophe was not escaped (Ian's WP2PunBB Plugin) and this effectively killed the script. When corrected, it works as expected.

Though, I ran into another problem. My wp uses utf-8 with iso-8859-2 collation and the posts transferred to punBB appears as unencoded utf-8.
I wonder, if it could be circumvented, anyhow.

11

Re: Wordpress plugin to post to PunBB

Sorry, but can you clarify what the fix is? A line number, perhaps? I can't seem to find it...

12

Re: Wordpress plugin to post to PunBB

line number: 147
<h2>Ian's WP2PunBB Plugin</h2>
You should escape the apostrophe there or it destroys the underlying code.

13

Re: Wordpress plugin to post to PunBB

I admit, I was not able to escape it properly myself so I just omitted it.
<h2>WP2PunBB Plugin - Ian Huston</h2> smile

14 (edited by Psykotik 2005-10-13 16:46)

Re: Wordpress plugin to post to PunBB

Kassad wrote:

I admit, I was not able to escape it properly myself so I just omitted it.
<h2>WP2PunBB Plugin - Ian Huston</h2> smile

You do not have to escape it, since a html section does not need it. Your "fix" is useless...

Kassad wrote:

Though, I ran into another problem. My wp uses utf-8 with iso-8859-2 collation and the posts transferred to punBB appears as unencoded utf-8.
I wonder, if it could be circumvented, anyhow.

I bypassed it by converting all PunBB tables and pages to utf-8. Forget this solution if you have many messages in your forum, as you'll have to manually convert posted data to utf-8. Well, if you have some sql knowledge, you may write a script smile

15

Re: Wordpress plugin to post to PunBB

Yeah, I looked into this, and I don't quite get it.

I can't get this plugin working - has anybody else?

16

Re: Wordpress plugin to post to PunBB

Sincerely, I do not know but definitely, it works.
That is enough for me smile

17

Re: Wordpress plugin to post to PunBB

Well, I was mystified a bit myself about this (my php knowledge is rare) but I swear it was the problem.
Just try it in a proper editor and see what happens.

Re: Wordpress plugin to post to PunBB

I cannot try, since the plugin does work on my side smile

(Well, actually I have had many problems a month ago, but it was related to my php5 installation)

19

Re: Wordpress plugin to post to PunBB

Anyone how how to make it post the complete post, including html? For some reason it is not posting the HTML into the punbb forum.

Thanks.

20

Re: Wordpress plugin to post to PunBB

I fixed it myself.
If you want to do it too, open ih_wp2punbb.php

Find:
$message = ih_cleanArticle($message);
Replace with:
//$message = ih_cleanArticle($message);

21 (edited by Stahn 2006-06-01 17:06)

Re: Wordpress plugin to post to PunBB

I'm getting this error when posting, and I don't know what to do:

Fatal error: Cannot redeclare unregister_globals() (previously declared in /home/httpd/vhosts/*/httpdocs/universe/wp-settings.php:4) in /home/httpd/vhosts/*/httpdocs/universe/forums/include/functions.php on line 1034

The post is made on WordPress but doesn't creates a topic in the forum.

22

Re: Wordpress plugin to post to PunBB

Stahn wrote:

I'm getting this error when posting, and I don't know what to do:

Fatal error: Cannot redeclare unregister_globals() (previously declared in /home/httpd/vhosts/*/httpdocs/universe/wp-settings.php:4) in /home/httpd/vhosts/*/httpdocs/universe/forums/include/functions.php on line 1034

The post is made on WordPress but doesn't creates a topic in the forum.

Hi everyone. First I'd like to to thank ihuston for this plugin. It works like a charm!

Stahn: just do what Rickard suggests in this post. It fixed that error for me.

23

Re: Wordpress plugin to post to PunBB

Zaccix wrote:

Stahn: just do what Rickard suggests in this post. It fixed that error for me.

Thank you so much! It did worked smile

24 (edited by Stahn 2006-06-23 03:54)

Re: Wordpress plugin to post to PunBB

Hmm, I've got a little question, to the people that are using this...

Everytime I edit a post in WordPress (and save the changes), the plugin publishes a new post in PunBB. Is there a way to disable this?

25

Re: Wordpress plugin to post to PunBB

Isn't that the whole point of the plugin?