WordPress/BBPress Single Sign On
-
I’ve read through multiple posts about WordPress/BBpress integration but cannot find the answer to one question.
Is single sign on supported?
I understand that the same username and password is shared between the two sites, but if I log into WordPress do the same cookies automatically log me into BBpress?
-
Should be. If they are on the same domain, it is certainly possible. In a small set of cases you will need to add two simple lines of code to your bbpress config.php. What URLs do you (want to) have bbpress and wp at? Tell us and we can tell you what code to add.
If you have the same domain so it should be simple. Keep in mind that bbPress will use the WP users after doing this and both programs have to be installed in the same database:
// The rest is only useful if you are integrating bbPress with WordPress.
// If you're not, just leave the rest as it is.
$bb->wp_table_prefix = 'wp_'; // WordPress table prefix. Example: 'wp_';
$bb->wp_home = www.nyquistcapital.com'; // WordPress - Options->General: Blog address (URL) // No trailing slash. Example: 'http://example.com'
$bb->wp_siteurl = 'www.nyquistcapital.com'; // WordPress - Options->General: WordPress address (URL) // No trailing slash. Example: 'http://example.com'Trent
You may have to add
$bb->cookiepath = '/';
to your config.php if it doesn’t work straight away.
I did the original install as Trent specified above. I also added in fel64’s suggestion. I didn’t see any changes in the behavior as a result.
Let me reiterate. BBPress and WOrdpress are sharing a user database now. I can sign into BBPress using the name/pw combo of any existing WordPress user.
What I expected though, is that a user already signed into WordPress would transition into BBPress (for the first time, as a new user) and automatically be logged in. Currently, they need to relogin using the same WordPress username and password.
Which behavior should be expected? I am looking for a seamless addition of forums for my existing client base….
Thanks for the great help.
Expected behaviour is that signing into one will sign you into the other.
Can you please do the following:
Clear your cookies.
Log into wordpress and record what cookies are set, including domain and path (properties of each cookie).
Clear your cookies again.
Log into bb. Again record the cookies set. Are you logged into wp?
Tell us the cookies set from each case.
I think I see the problem now. BBPress is setting a different MD5 hash than wordpress. This must have to do with the fact it is installed in the subdirectory. Why is my install generating the wrong hash…
My config.php is set up as above. Ive pasted it below. I included the full URL coding where as you used only the http://www.xxxx.xxxx – I can’t imagine that makes a difference.
$bb->wp_table_prefix = ‘wp_’; // WordPress table prefix. Example: ‘wp_’;
$bb->wp_home = ‘http://www.nyquistcapital.com/’; // WordPress – Options->General: Blog address (URL) // Example: ‘http://example.com’
$bb->wp_siteurl = ‘http://www.nyquistcapital.com/’; // WordPress – Options->General: WordPress address (URL) // Example: ‘http://example.com’
$bb->cookiepath = ‘/’; // Added per BBPress Forum Suggestion to ensure WordPress user sharing
wordpressuser_ed93838a3c2677b2a3d53669c26b039b
Path: /
Content:admin
wordpresspass_ed93838a3c2677b2a3d53669c26b039b
Path:/
Content:<HASH>
And for BBPress
wordpressuser_34c5633735768bf923be82cd0042b16a
Path: /
Content:admin
wordpresspass_34c5633735768bf923be82cd0042b16a
Path:/
Content:<HASH>
Try adding the following to your bbPress config.php:
$bb->usercookie = 'wordpressuser_full.hash.number";
$bb->passcookie = 'wordpresspass_full.hash.number";Trent
I assume you mean….
$bb->usercookie = ‘wordpressuser_full.hash.number’;
$bb->passcookie = ‘wordpresspass_full.hash.number’;
double quotes at end changed to single. Trying now.
Darn copy and paste….
Trent
Now I can’t log in to BBPress. Changing the config.php back.
Is there something atypical about my install that is creating the problem. How can I just conform to the norm?
I still have the cookiepath variable set… can I remove that?
Most just work with defining the wordpress part of the config.php and some need to play around. As well, there is always defining the cookie domain from https://bbpress.org/forums/topic/cookie-domain-settings?replies=4
Trent
Remember that many users will already have the “remember me” set for their cookie on wordpress and that doesn’t expire for a year. This means their bbpress login will mysteriously fail. They’ll either give up or re-register a new nickname.
You also need the space and period plugin fix for names. WordPress allows them, bbpress doesn’t by default. So anyone with a space or period in their nickname will fail logging into bbPress. Not knowing such things can drive you mad.
I also went a step further and routed all the login links on bbpress back to the wordpress login box since it has a few extra features. I use the redirect_to option to bring them back to bbpress.
ps. another good integration thread for a future integration sub-forum
I think we should write up a massive thread on all the things to do for proper integration since there are bits and pieces that work for most people all over this forum.
Trent
Everything _ck_ mentions is what I want to do.
OK, feeling pretty stupid now.
I used the first suggestion:
$bb->usercookie = ‘wordpressuser_full.hash.number’;
$bb->passcookie = ‘wordpresspass_full.hash.number’;
Except this time I replaced it with my actual MD5. DUH!!!
$bb->usercookie = ‘wordpressuser_ed93838a3c2677b2a3d53669c26b039b’;
$bb->passcookie = ‘wordpresspass_ed93838a3c2677b2a3d53669c26b039b’;
Things working smoothly now. Thank you for your help and I hope this thread helps someone else.
Next step will be this…
I also went a step further and routed all the login links on bbpress back to the wordpress login box since it has a few extra features. I use the redirect_to option to bring them back to bbpress.
I’ll search the forum but any guidance is appreciated.
There is an obscure cookie control plugin for wordpress that I found somewhere around here I think:
http://www.2diabolos.com/blog/plugins-pour-wordpress/setcookieparams/
the bbpress config options you want are like this:
$bb->wp_table_prefix = 'wp_'; // WordPress table prefix. Example: 'wp_';
$bb->wp_home = 'http://example.com/blog'; // WordPress - Options->General: Blog address (URL) // Example: 'http://example.com'
$bb->wp_siteurl = 'http://example.com'; // WordPress - Options->General: WordPress address (URL) // Example: 'http://example.com'
$bb->usercookie = 'wordpressuser_ab1b1c8b2de0ca2b381c25a6b6e812a1';
$bb->passcookie = 'wordpresspass_ab1b1c8b2de0ca2b381c25a6b6e812a1';
$bb->cookiedomain = 'example.com';
$bb->cookiepath = '/';you also obviously want this plugin:
https://bbpress.org/plugins/topic/2?replies=3
and less obviously this one is a must for WP integration:
https://bbpress.org/forums/topic/usernames-with-spaces-do-not-work?replies=24#post-7904
unfortunately it’s not setup here as a formal plugin but it should be – see my dot fix at the end
Yes, but users reading the above… make sure to replace the MD5 hash with the one from your site. Do not simply cut and paste.
This means their bbpress login will mysteriously fail.
No it won’t. No matter what cookies users have, they will not prevent them logging in.
schmitt, must say I really liked your site. Not at all interested in things financial but it was engaging nonetheless.
You could put these lines at the top of your bb-login.php:
header('Location: http://www.example.com/');
exit;Obviously changing the URL to that of your wp-login.php. I don’t know how else you’d do that. This may have all sorts of crazy adverse effects because I haven’t tried it myself; maybe ck can say how he did it?
Hey guys, I got a question about the MD5 hash…..
I don’t understand which MD5 to use… Every user has a different hash right? So which one do I enter?
Can anyone try and clarify this for me, I almost got it working….
MD5 is unique to the website URL… not the user.
Thanks schmitt, got it working without too much trouble.
Hi,
I am trying to integrate bbpress(0.8.3.1) with wordpress mu (1.3.3), and I am having some issues with cookies for login/logout.
I’ve tried setting this: (“MD5hash” replaced with my MD5)
$bb->usercookie = 'wordpressuser_MD5hash';
$bb->passcookie = 'wordpresspass_MD5hash';However, that didn’t seem to synchronize login(meaning, if I am log into wp, go to bbpress and find myself already logged and vice versa)
Watching the cookies during the login/out process on WP MU, I found that the cookie names that WP MU uses are: “wordpresspass” and “wordpressuser”
So in config.php for bbpress, I used:
$bb->usercookie = 'wordpressuser';
$bb->passcookie = 'wordpresspass';This works somewhat, let me explain:
This scenario works:
Log into WPMU, refresh bbpress page, I find myself already logged into bbpress.
Log out of WPMU, refresh bbpress page, I find myself logged out of bbpress.
Log into BBpress, refresh WPMU, I find myself logged into WPMU
This doesn’t work:
Log into BBpress, refresh WPMU (I find myself logged into WPMU) AND THEN when I try to log out from WPMU, I can’t log out.
I refresh BBpress page, and I am not logged out either.
If I log out from BBpress at this point, then I am logged out of WPMU as well.
I have a feeling it might be something with WPMU, but I thought I’d post here first since this is where I found all the information about the integration. Thanks for your help. I am appending my config.php relevant to the integration part.
$bb->wp_table_prefix = 'wp_';
$bb->wp_home = 'http://achillesblog.com';
$bb->wp_siteurl = 'http://achillesblog.com';
$bb->usercookie = 'wordpressuser';
$bb->passcookie = 'wordpresspass';
$bb->cookiepath = '/';thanks for your help.
- You must be logged in to reply to this topic.