Topic: WordPress PunBB db integration workaround

What I have been wanting to do for a while is for members to be able to open an account with punbb and then post comments in wordpress with that punbb account.

I don't think anyone has actually done this yet?  or if they have there not sharing it.

But I might have a workaround.  Now I am not a programmer so tell me if I'm being an idiot...but it might just work.

Basically what you could do is edit the comment code in WordPress like this...

First you edit the wordpress comment code by putting an if statement along these line:

if ($pun_user['is_guest']) {

echo "you must be logged in to comment on articles";
}
else
{
DISPLAY THE WORDPRESS COMMENT BOX IN THE NORMAL WAY
}

Now you edit the wordpress comment box in such a way that it doesn't give you the option to edit the name field (and you remove the need for the email address)...instead it grabs the name of the punbb member in question and forces that name to be sent to the wordpress db when you hit submit.

You could use this to grab the username:   pun_htmlspecialchars($pun_user['username'])

Now this may not work as you may not be able to call these punbb things inside the comment part of wordpress, and even if it does work it would be an ugly hack.  But until someone makes a proper bridge it might suffice.

Thoughts anyone?   Am I being a moron or might this work?

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

Re: WordPress PunBB db integration workaround

I'm not sure how great an idea it is to insert values into the Wordpress comment box like that because it doesn't seem as if that in any way stops a malintentioned user from writing their own comment form that will submit any name they wish. Also, it will cause problems if a user's name on the forum is edited.

It might be better to modify Wordpress to fetch the user ID when processing the comment and insert that in place of the name and then editing the comment display to fetch the username based upon each user ID (that could probably be done with a JOIN on the query that fetches the comments).

Looking for a certain modification for your forum? Please take a look here before posting.

Re: WordPress PunBB db integration workaround

good points.

by a malintentioned user you mean they could alter the browser side page source  to have a different name and then hit send and send someone else's name?

would they not need ftp access for this?

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

Re: WordPress PunBB db integration workaround

Ok, let's say I'm this malintentioned user. I'll view your page's source and look at the action attribute of the form and the name attributes for all the inputs. Then, I'll write my own form to match (with the name field editable), save it to my computer, open it in my browser, and let the fun begin.

The problem is that anyone can send data to a comment form, forum, etc. It's up to the site's owner or software's developer to account for this. For example, PunBB (for some forms) and many other applications use referrer checks to prevent such an attack, but referrer headers are easily spoofed (I think I read on Trac or the PunBB development blog that another system was being implemented). I'm not sure whether or not Wordpress has anything against this in place.

In short: don't send users' identities through a form. Use PunBB's integration features to determine users' identities on the page that processes the form (not the page that displays it).

Looking for a certain modification for your forum? Please take a look here before posting.

Re: WordPress PunBB db integration workaround

Ah I see what you mean.

So I should write some php in the code where wordpress processes the submitted comments to alter the need for a username and instead grab the current users id from the db.

Won't calls to punbb current user data be out of scope inside wordpress's workings?

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

Re: WordPress PunBB db integration workaround

If you include the proper files to integrate with PunBB as outlined in the docs, it should work. $pun_user['username'] will suffice if you want a lazy hack; $pun_user['id'] would be better but you'd need to alter the datatype of the name column in Wordpress's database and alter the query in Wordpress's comment display to join with PunBB's user table.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: WordPress PunBB db integration workaround

the lazy hack is fine for me as long as it is secure enough...I can see that doing it server-side is definitely better.

I will try it out when I have a free moment and let you know if it works.

Thanks for all your help.

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

8

Re: WordPress PunBB db integration workaround

nice idea, i'll wait for your work smile

Re: WordPress PunBB db integration workaround

should also be able to grab the avatar from the punbb avatar folder at the point when the comments are displayed...that is a real incentive for me to use the user ID and not the username (as the user ID is required to get the avatar).

@ siRio:
Don't hold your breath, I will probably do this in a month or so...right now I am just planning out what upgrades to make.

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

10 (edited by nickfzx 2007-05-12 06:56)

Re: WordPress PunBB db integration workaround

so I have now done this...took around 3 hours...I think I have made it so it is secure.

I have made it grab the avatars too which is cool.  So now you can comment on wordpress articles if you are logged into punbb or wordpress...if you are not logged in to wordpress or punbb you can't comment.

If you have an avatar in your punbb profile then it will be put next to your name in the comment, if you don't have an avatar then nothing will show.

if you are logged into wordpress and punbb at the same time then the wordpress user info is used and punbb is ignored.  As my members aren't allowed to login to wordpress (only punbb) this isn't a problem for me.

The affected files are:
wordpress/wp-comments-post.php
and
wordpress/wp-content/themes/YOUR_THEME/comments.php

Replace the 2 files:   (make sure to backup)
http://nickfranklin.googlepages.com/wp- … s-post.php
http://nickfranklin.googlepages.com/comments.php

To adapt this to your theme just see what I have done to my comments.php theme file and do the same to yours - I have commented all of my changes in both files with // CHANGED FOR PUNBB INTEGRATION or something similar so just do a search for PUNBB to see where I have made changes.

I have only tested this with wordpress 2.0.3, I am going to upgrade to 2.1 soon and I imagine it will still work fine.

Let me know what you think...cheers, Nick


edit:
I diddn't mention above that you have to include this code somewhere:

<?php
define('PUN_ROOT', '../punbb/');
include '../punbb/include/common.php';
global $pun_user;
?>

I put it near the top of my index.php wordpress theme file so that it is always there wherever I am in wordpress.

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

11

Re: WordPress PunBB db integration workaround

Nickfzx, wink

Wordpress login and Punbb login must be the same or not ?
Have you see that thread to ? A wordpress plugin to manage punbb users by Wordpress.
http://punbb.org/forums/viewtopic.php?pid=99533
Could we use twice ? smile

Benoît V.
My Board

12 (edited by nickfzx 2007-09-01 22:36)

Re: WordPress PunBB db integration workaround

Bloody wrote:

Nickfzx, wink

Wordpress login and Punbb login must be the same or not ?
Have you see that thread to ? A wordpress plugin to manage punbb users by Wordpress.
http://punbb.org/forums/viewtopic.php?pid=99533
Could we use twice ? smile

my mod has no connection or reliance on the mod you refer to ... it stands up on its own.  My mod does not integrate the wordpress login system with punbb login system.  What it does is prevent people who are not logged into punbb from making a comment on a wordpress article and also when a logged in member does make a comment it grabs their punbb username and avatar so that it gives the illusion of a bridged system.

I am not sure about using the two mods together...give it a try if you need the functions of both smile   the more mods you do though the harder it's going to be to upgrade.

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

13 (edited by Bloody 2007-09-02 11:48)

Re: WordPress PunBB db integration workaround

Thanks !! I think, I will not use this two mods together.
Your comments system please me.
Did you think, you can change your hack to integrated this punbb pluging ? smile

Benoît V.
My Board

Re: WordPress PunBB db integration workaround

Bloody wrote:

Thanks !! I think, I will not use this two mods together.
Your comments system please me.
Did you think, you can change your hack to integrated this punbb pluging ? smile

sorry I won't be making any more changes to this mod...lack of time

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community

15

Re: WordPress PunBB db integration workaround

Don't be sorry nicefzx.
I'm be nice to talk with you. smile

Benoît V.
My Board

16

Re: WordPress PunBB db integration workaround

bloody ur site look very good but the images padding is off in FF and IE6!

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

17

Re: WordPress PunBB db integration workaround

Yes, I know Quaker. lol
Look at my test website under Wordpress, there : http://www.chantdeleau.com/wordpress/ smile
It will be better. tongue

Benoît V.
My Board

18

Re: WordPress PunBB db integration workaround

Fatal error: Call to a member function rs_isEmpty() on a non-object in /home2/c/chantdeleau/www/wordpress/wp-content/plugins/wordpun/wordpun-class.php on line 292

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

19

Re: WordPress PunBB db integration workaround

Oups !! tongue
Right now. big_smile

Benoît V.
My Board

20

Re: WordPress PunBB db integration workaround

hi i am try this hack  in wordpress 2.5.1

i changed and mix your code from
wordpress/wp-comments-post.php
and
wordpress/wp-content/themes/YOUR_THEME/comments.php



in 2.5.1

"You must be logged in to post a comment"  is not show

um.. iam not login

THank you.