bbPress

Simple, fast, elegant

bbPress Plugin Browser »

Freshly Baked Cookies for bbPress (0.0.3)

Download

Version: 0.0.3

Last Updated: 2009-3-13

Requires bbPress Version: 0.9 or higher

Compatible up to: 0.9

Author Homepage »

Plugin Homepage »

Donate to this plugin »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(2)

Your Rating

Author: _ck_


  1. _ck_

    Moderator

    The logout should work on either side.
    It's possible I have a bug in the logout process.

    Keep in mind the administrator auth cookie (admin menu cookie) on the WP side is a separate cookie and bbPress doesn't attempt to clear that, only the login cookie.

    update: I don't see any obvious bug in the logout
    are you positive the cookie names are identical on both sides?
    Can anyone else confirm this bug?

    ps. you aren't trying to use this plugin with deep (full) integration are you? It won't work.
    You'd have to use Ann's method from the WordPress side instead.

    Posted: 1 year ago #
  2. I don't have deep integration. And logins/logouts from Wordpress Side work fine.

    Ok. The problems are (always when login/logout) on bbPress:

    Only the login cookie is set/cleared. Any other auth cookie for WordPress is set/cleared.

    By not setting/clearing the admin cookie and others, when you logout on bbPress you can still access the admin panel on WordPress. On the WordPress frontend (posts and pages) you appear as logged out, but you can access the admin panel.

    When you login on bbPress you are looged in the WordPress frontend (pages and posts). But You cannot access the WordPress dashboard, as you have not the admin cookie set.

    Just the problem is not setting/deleting the WordPress admin cookie when you login/logout on the bbPress side.

    I will take a look to your plugin to see about the admin cookie.

    The Ann's method does not work for me in WP 2.7.1... for some reason using it, I cannot correctly login to WordPress after installing Ann's plugin. (But this is another topic and case).

    Posted: 1 year ago #
  3. Hi,

    I did find this helpful, but you are plain WRONG about this:
    -------------------------------------------------------------
    If you can't get it to work, change the top of the plugin from
    define('COOKIEHASH', md5($bb->wp_siteurl));
    to
    define('COOKIEHASH', '566aa6a4748d08549933e157e66906c6');
    -------------------------------------------------------------

    The correct statement is you should look up your COOKIEHASH in your wp_config file and copy that exactly into the COOKIEHASH in the _freshly-baked-cookies.php file.

    My COOKIEHASH for WP 2.7 reads like this:
    define('COOKIEHASH', 'wordpress_566aa6a4748d08549933e157e66906c6');

    Changing that in my _freshly-baked-cookies.php file made the difference between getting LOGIN/LOGOUT working between WordPress 2.7 and BBPress 0.9.

    I'm only posting this because of the PITA I've had with this over the last day or so, AND, because of a similar problem trying to get external PHP Scripts to run - requiring WordPress login, what a big time pain.

    ALL of the problem was related to this damn COOKIEHASH, and getting it right!

    I hope someone, somewhere can also benefit from this - just remember - keep your COOKIEHASH exactly the same and follow the other integration steps, THEN install this Freshly Baked Cookies plugin into BBPress and all should be fine.

    Good luck
    -Brett

    Posted: 1 year ago #
  4. Txanyy,

    Ok, I do also have the same problem:
    -----------------------------------------
    When you login on bbPress you are looged in the WordPress frontend (pages and posts). But You cannot access the WordPress dashboard, as you have not the admin cookie set.
    ---------

    I cannot access the Admin panel, even though it looks like I am logged in to WP, not that big of a deal, but it is a problem.

    > I will take a look to your plugin to see about the admin cookie.

    Please let us know when this has been fixed, that one little issue and I think everything wil be fine...

    Thanks,
    -Brett

    Posted: 1 year ago #
  5. I found that if you're trying to do a *seamless* wordpress integration by using your wordpress theme for bbpress, the freshly baked cookies plugin doesn't work because it redeclares functions that are already declared in wordpress. Instead, use the the other method listed in the description (superann's method). It workes fine.

    Posted: 1 year ago #
  6. _ck_

    Moderator

    BrettDream, the instructions with the specific cookiehash were meant only for johnmc, not for everyone. Obviously everyone else will have different cookiehash.

    I guess the major oversight in this plugin is you will not be able to access the dashboard on the WP side, which 99% of regular users will not do.

    Ann's method is actually better.

    Posted: 1 year ago #
  7. Well. I've done some hacks with the plugin and now it works perfect. I try to explain what I did:

    Defined this at the top of the plugin's file:

    define('AUTH_KEY', 'my key from wordpress');
    define('AUTH_SALT', wordpress_salt');
    
    define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);

    On the wp_generate_auth_cookie() changed the line to get the salt to this one:

    $salt = ( $scheme == 'logged_in') ? apply_filters('salt', LOGGED_IN_KEY . LOGGED_IN_SALT, $scheme) : apply_filters('salt', AUTH_KEY . AUTH_SALT, $scheme);

    On the wp_set_auth_cookie() added those lines just after setcookie:

    setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->cookiepath .'wp-admin', $bb->cookiedomain);
    setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->cookiepath .'wp-content/plugins', $bb->cookiedomain);

    and the same after the set cookie in the if bellow that (changing $db-cookiepath by $bb->sitecookiepath).

    And on the function wp_clear_auth_cookie() added this lines:

    setcookie(AUTH_COOKIE, ' ', time() - 31536000, $bb->cookiepath . 'wp-admin', $bb->cookiedomain);
    	setcookie(AUTH_COOKIE, ' ', time() - 31536000, $bb->cookiepath . 'wp-content/plugins', $bb->cookiedomain);
    	setcookie(AUTH_COOKIE, ' ', time() - 31536000, $bb->sitecookiepath . 'wp-admin', $bb->cookiedomain);
    	setcookie(AUTH_COOKIE, ' ', time() - 31536000, $bb->sitecookiepath . 'wp-content/plugins', $bb->cookiedomain);

    With this changes login/logout is working perfect in all cases and does not matter if you login or logout in WoprdPress or bbPress.

    Just is a suggestion to add this changes to the plugin for everyone have a nice integration. Tested with three sites in WordPress 2.7.1 and works for me. Just you have to be careful if moved your wp-content or wp-admin to a non default location. In this case my hack will not work.

    Posted: 1 year ago #
  8. Txanny,

    Great! I now have just one problem. If I login to BBPress, then return to WP and go to Admin Panel, all works, I am logged in, BUT, if I log out of BBPress, then try to log out of WP Admin panel, I always get this error:
    ------------------------
    You are attempting to log out of MyDomainName.com

    Please try again.
    ----------------------

    It will not allow me to log OUT of admin panel from within WP, but only IF I log out of BBPress first. Any ideas what would cause this?

    Thanks for the hack, everything else works great! By the way I am on WP 2.7.0 (in root folder), BBPress 0.9 (in forums folder).

    Posted: 1 year ago #
  9. _ck_

    Moderator

    Txanny, your idea is good and valid but in your code for wp_set_auth_cookie you refer to $auth_cookie which is not defined, so I added

    $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, 'auth');

    But there are some overall hacks with this that worry me.

    I encourage people to use Ann's WP downgrade method instead.

    But here's a fully hacked copy with your suggestions:
    http://pastebin.com/pastebin.php?dl=f1e5e86fc
    Let me know if it works and I will put it on the SVN.

    Posted: 1 year ago #
  10. _ck_ It works for me. Perfect. Just a couple or lines where missing:

    When creating the cookies shoult be

    setcookie(LOGGED_IN_COOKIE, $cookie, $expire, $bb->cookiepath, $bb->cookiedomain);
    setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->cookiepath .'wp-admin', $bb->cookiedomain);
    setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->cookiepath .'wp-content/plugins', $bb->cookiedomain);
    if ( $bb->cookiepath != $bb->sitecookiepath ) {
    		setcookie(LOGGED_IN_COOKIE, $cookie, $expire, $bb->sitecookiepath, $bb->cookiedomain);
    		setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->sitecookiepath .'wp-admin', $bb->cookiedomain);
    		setcookie(AUTH_COOKIE, $auth_cookie, $expire, $bb->sitecookiepath .'wp-content/plugins', $bb->cookiedomain);
    	}

    Escept for that, it works OK.

    BrettDream I have not seen this issue. Well just in one case: If I have to tabs in my browser open one with bbpress and another with WordPress panel. If I logout in bbPress and try to logout in WordPress, I get this error. IT'S NOT AN ERROR. You logout in bbPress, so you also closed your session in WordPress and cannot logout again. Try to reload the WordPress panel and you will see the login box.

    Posted: 1 year ago #
  11. _ck_

    Moderator

    I've now updated to 0.0.3 with the improvements from Txanny - thanks Txanny.

    Posted: 1 year ago #
  12. btwilkins - Hmm, things are getting more complicated - that is not what I was trying to do, but the long way around it, that is really what I wanted to do - have a 'Forums Tab', when you click it, goes to BBPress Forums - so a quick question to you:
    WHAT is the fastest/easiest method I can perform this integration with the templates/graphics in BBPress (I noticed there are several methods of doing this listed in that thread, which is best? )

    Regarding the superann plugin, I tried that first, but found out it was not logging me in properly - however, I was opening a 2nd tab with Forums in it (as Txanny said) - freshly-baked cookies solves all of those problems, but I'm not 'seamlessly integrated' as you say - which is what I really want.

    Another funny thing, every time I re-activate Superann plugin I have to reset cookies, so it's still doing something... are you saying all I need to do is re-activate Superann, deactivate freshly-baked and then somehow get the templates to look right in BBPress? If so I would prefer that - I really don't want secondary tabs opening up with forums in them - however as _ck_ points out early in an integration thread - that type of integration is more resource intensive - so that's why I gave up initially - if it turns out it's not that much more resource intensive - then I'll pursue it - please give me a quick summary on getting it done?

    Txanny - as you say, this is exactly when it happens: If I have to tabs in my browser open one with bbpress and another with WordPress panel. If I logout in bbPress and try to logout in WordPress, I get this error. IT'S NOT AN ERROR.

    So, I think what I really want is a seamless integration (using Superann plugin), and not a separate tab/window opening using freshly-baked.

    Posted: 1 year ago #
  13. adeboy

    Member

    Hi, I get "Plugin could not be activated; it produced a Fatal Error." when I try to activate this. I have 2.71 & 0.904 with wordpress in a sub folder and bb press in a sub sub folder:

    /wordpress/
    /wordpress/forum/

    No other plugins in BBPress

    Posted: 1 year ago #
  14. _ck_

    Moderator

    there should be a leading underscore on the plugin to make it auto-activate

    if you try to install it like a regular plugin will will fail with the activation error you posted

    Posted: 1 year ago #
  15. Hello!

    I have installed WP 2.7.1, freshly installed bbpress 0.9.4
    PHP 5

    Seems like I did everything as it says in the instructions. Login/Logout in wordpress works just fine but if I',m trying to login in the bbpress I'm getting the install.php page.

    How can I troubleshoot it? How can I find where I was wrong?
    Can somebody help me?

    Posted: 11 months ago #
  16. Hello!

    I've integrated the WP 2.7.1 and bbpress 0.9.4.

    Right now it seems like it working. But something not right anyway. Login/Logout working just fine. My only problem is when I log in to the bbpress as Administrator I can't see any settings, plugins, etc.

    All I can see in /bb-admin

    Dashboard Users and Manage tabs.

    Nothing else

    Can somebody help me? Please, what I need to check and where I can fix it?

    What I did wrong?

    Posted: 11 months ago #
  17. citizenkeith

    Member

    I had better luck with this one than I did with Anne's WP plugin. Thanks again for your work and dedication, _ck_!

    Posted: 11 months ago #
  18. _ck_, you are a superstar. It has become clear to me that I need way more sleep than I was getting when I started all of this. I made some really stupid mistakes when installing this. I installed the latest version, corrected my mistakes and it is all working beautifully. Expect a gift card soon. :)

    Posted: 9 months ago #
  19. _ck_

    Moderator

    Can someone test this new version of Freshly Baked Cookies with bbPress 0.9 + WP 2.8.1 and let me know if it works and cookie sync is maintained?

    http://bbshowcase.org/plugins/freshly-baked-cookies.zip

    Don't forget to copy over your settings at the top of the plugin and remember to set the AUTH_COOKIE_VERSION to 2 for WP 2.8

    I have a hard time believing it's that simple to fix for WP 2.8 vs 2.7 but here's hoping.

    Posted: 8 months ago #
  20. helgetry

    Member

    Works for me! :-)

    Posted: 6 months ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.