Topic: WordPress comments <-> PunBB topic

I know there's already something like a Wordpress/PunBB integration that syncs the user tables. But that's not what I'm looking for.

I need a plugin for PunBB/Wordpress that replaces the Wordpress comments by PunBB topics. It doesn't have to be very complex or so. It should work this way:
When I post a new blog entry in Wordpress, it also automatically creates a new topic with the same title. And the comments link in Wordpress redirects to this topic. So that the users read the news in the blog, but can comment it in the forum.

An example: I'll write a blog entry "Great news about XYZ!" and when I publish it, it will normally be published PLUS in my PunBB forum is a topic created (by my admin account or a dummy account), named "Great news about XYZ!" and it contains a link to the blog entry and a small sentence like "You may discuss this news here."

Is this easy possible?

Re: WordPress comments <-> PunBB topic

This would be useful for my site too.

Re: WordPress comments <-> PunBB topic

i do something simular with a mysql trigegr (version 5) smile

have a 'on insert' trigger on your blog table (or however its called) let this trigger insert a new entry in the topics table and one in the posts table and your ready ...

here is an example that i use for this purpose

delimiter |

CREATE TRIGGER newsToForum AFTER INSERT ON news
    FOR EACH ROW
        BEGIN
            DECLARE x INT;
            DECLARE y INT;
            IF New.approved = 1 THEN
                INSERT INTO forum_topics (poster, subject, posted, forum_id, last_post, last_poster) VALUES ('newsMonkey', NEW.title, UNIX_TIMESTAMP(), 12, UNIX_TIMESTAMP(), 'newsMonkey');
                set x = LAST_INSERT_ID();
                INSERT INTO forum_posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUE ('newsMonkey', 19455, '::1', NEW.txt, UNIX_TIMESTAMP(), x);
                set y = LAST_INSERT_ID();
                UPDATE forum_topics SET last_post_id=y, first_post_id=y WHERE id=x;
                update forum_forums set num_topics = num_topics + 1, num_posts = num_posts + 1, last_post = UNIX_TIMESTAMP(), last_post_id =y, last_poster='newsMonkey' where id = 12;
                update forum_users set num_posts=num_posts + 1, last_post = y where id = 19455;
            END IF;
        END;
|
delimiter ;
~Cereal
I've finally learned what "upward compatible" means. It means we get to keep all our old mistakes.
The limits of language are the limits of one's world.

4 (edited by guest1234 2009-03-18 18:08)

Re: WordPress comments <-> PunBB topic

Thanks, I'll try it and report how it works.

But I'd still rather like a Wordpress plugin that does it automatically or a PunBB plugin that automatically checks the wordpress tables for new entries.

edit: Uh, where/how to define Triggers in phpMyAdmin?

5

Re: WordPress comments <-> PunBB topic

maststef wrote:

Is this easy possible?

It's possible, we did it with Nucleus CMS and PunBB 1.2.x

http://bertgarcia.org/nupusi:punbb:tutorials:np_punbb

Maybe you can adapt the code to work with Wordpress and PunBB 1.3.x?

Re: WordPress comments <-> PunBB topic

Are there any news on this?

I did not get it working.