Skip to:
Content
Pages
Categories
Search
Top
Bottom

First pass at a fix for “deep” integration in trunk

  • @sambauers

    Participant

    A first attempt at getting WordPress 2.7 and bbPress 1.0 to play nice again is now in trunk [1862].

    I’m specifically talking about “deep” integration, i.e. when you include WordPress inside bbPress to gain access to WordPress’ functions.

    This will need a lot of testing, so please post any issues you have on the relevant Trac ticket, #972 (which will stay open until some more testing has occurred).

    I recommend using the following code at the top of your bbPress bb-config.php file to include WordPress inside bbPress:

    if ( !defined( 'ABSPATH' ) ) {
    include_once( '/Full/Path/To/wp-load.php' );
    }

    Note that this includes “wp-load.php” not “wp-config.php” or “wp-blog-header.php”. This avoids running WordPress’ template loader which presumably isn’t needed inside bbPress. Some implementations may want it though, so if you find you need it then give it a go and let us know how that goes.

    Also note that all filters and actions set in WordPress whether default or added by plugins or themes are cleared out completely. That means that plugins and themes installed in WordPress cannot add filters or actions to bbPress at all. This may have some implications I’m not aware of yet.

    Go nuts!

Viewing 25 replies - 1 through 25 (of 26 total)
  • @johnjamesjacoby

    Keymaster

    I will fully test this tomorrow. Thanks for pounding this out so quick.

    @filosofo

    Member

    Thanks! I abandoned trunk bbPress months ago because I couldn’t do the “deep” integration without too many core hacks. It will be good to come back.

    @johnjamesjacoby

    Keymaster

    Well, my first impression of beta 3 without including is that login integration doesn’t work at all.

    Without the “deep” integration in the bb-config.php:

    1. Logging into WordPress leaves me logged out of bbPress.
    2. Logging into bbPress leaves me logged out of WordPress.
    3. Logging out of bbPress leaves me logged into WordPress.
    4. Logging out of WordPress leaves me logged into bbPress.

    With the “deep” integration in the bb-config.php:

    1. Logging into WordPress leaves me logged out of bbPress.
    2. Logging into bbPress leaves me logged out of WordPress.
    3. Logging out of bbPress leaves me logged into both bbPress AND WordPress.
    4. Logging out of WordPress leaves me logged into bbPress.

    So, login integration worked better in beta 2 unfortunately.

    I haven’t tested the themes or functions yet however.

    @ipstenu

    Moderator

    Interesting… With shallow integration, logging into bbPress logs me (as user and admin) into WordPress as a user but NOT as an admin. For about 20 minutes. Then I tested Deep Integration and now it fails all together.

    @sambauers

    Participant

    Something else has fallen out of sync. Working on it now.

    @johnjamesjacoby

    Keymaster

    Neither alpha3 nor the trunk versions of bbPress seem to create cookies for WordPress. Basically either way fails to generate the others’ cookies.

    I might be missing the mark on this one, but is the point of deep integration to have 1 single log in, or to allow use of WP functions inside BBP?

    I think the end result we’re mostly looking for, is a unified front from any direction. BBP functions in WP, and WP functions in BBP, with 1 login and registration. Which makes me think that BBP needs to be a WP plugin more than a stand along product to serve this purpose.

    I also noticed that the bbPress install doesn’t ask for the nonce key or salt from WordPress. Possible this could be an issue also?

    @sambauers

    Participant

    OK, this is fixed in trunk now. Just a stupid error on my part in a new function.

    I’ll see if it’s possible to re-release the 1.0-alpha-3 or maybe just bump up to 1.0-alpha-4.

    @johnjamesjacoby

    Thanks for your investigations. “Deep” integration is just there to allow you to use WP functions inside bbPress, you still need to setup cookie and user database integration separately.

    There is no way (that I know of) to get bbPress functions inside WordPress. It may “just work” now because of recent changes, but I’m definitely drawing the line there in terms of what we support. bbPress Live should mature further to provide the display of all manner of bbPress data inside WordPress via XML-RPC.

    The idea of bbPress running as a plugin is an interesting one, and I’ve thought about it before. It would be a hefty plugin though. I would be interested in seeing a plugin that kind of loaded bbPress like a library and allowed that sort of level of integration, but again, it would be basically loading all of bbPress inside WordPress. Generally, I think we have a stronger foundation as a stand-alone product rather than a plugin and if we can make integration easier by various means then there shouldn’t be a need for it.

    The nonce keys don’t need to be shared thankfully – I almost screamed when I saw those added to WordPress.

    @johnjamesjacoby

    Keymaster

    Thanks for the response and it clarifies all of my questions.

    Regarding nonces, the catch twenty-two with them would be if logging in and logging out of either/or BBP or WP don’t both affect both, or if adequate traps aren’t placed to disallow one or the other.

    Example is visible at my live test site http://www.delsolownersclub.com. If you’d like to try this, register yourself and use the invite code “bbpress”. (Registering makes you a WP contributor, and I need to assign your membership role in the BBP admin manually as of right now.)

    When you’re in the forums, the logout link won’t work, because the login through WP generates a nonce that BBP doesn’t know and can’t find. Because the nonces are by design different, if I login through WP and try to logout through BBP, WP will pitch a fit without the correct nonce. Make sense or am I off track here?

    @ganzua

    Member

    OK, this is fixed in trunk now. Just a stupid error on my part in a new function.

    I’ll see if it’s possible to re-release the 1.0-alpha-3 or maybe just bump up to 1.0-alpha-4.

    So, what did it happen? Is it the fix already included in the download right now? I’d like to give it a try :)

    @sambauers

    Participant

    The fix is only in trunk right now, but expect a new release in the next couple of days.

    @sambauers

    Participant

    @johnjamesjacoby

    The login forms don’t pass around nonce values generally, so it should be of no concern.

    What happens as of right now is that the role map you setup in the admin area only gets applied to new registrations either when you save the changes on that role map form or when the new WordPress user who is missing the role in bbPress logins in through bbPress.

    On your site as it is right now this never occurs because you force all logins through WordPress. Just now in trunk I have changed that so that just visiting the bbPress site with a valid cookie will set your role in bbPress.

    I suspect that all the problems with loging out in your case are going to come down to having a bunch of stuff manually set in your wp-config.php and bb-config.php

    Here’s what I think you should do…

    1. Update bbPress to the latest trunk version
    2. Remove any hardcoded settings in bb-config.php and wp-config.php WRT integration
    3. Install this brand spanking new plugin (get the trunk version for the moment) http://svn.wp-plugins.org/bbpress-integration/trunk/
    4. Recheck your integration settings in bbPress – don’t hardcode anyting into bb-settings.php
    5. Configure that plugin in WordPress
    6. Copy the wp-settings.php lines specified in that plugin to wp-config.php (probably only one line for you)

    Let us know how that goes.

    @ganzua

    Member

    Hey Sam

    What’s the file you changed? Is it possible to download from here?

    http://svn.automattic.com/bbpress/trunk/

    @sambauers

    Participant

    @ganzua

    New 1.0-alpha-4 now available from the download page:

    https://bbpress.org/download/

    The six-step cookie-sharing integration works for me with WP 2.7 and BB 1.0-alpha6. Thanks a bunch!

    Issues that I encountered on this journey:

    – Had to set ADMIN_COOKIE_PATH in wp-config.php (seems to be unrelated to BB)

    – I created a fresh bb-config.php using the installer. It seems to create WP settings as well, which didn’t work with my custom table prefix in WP -> manually fix it in bb_meta

    – WP integration options in BB somehow created user_bbdb_user and user_bbdb_password options in bb_meta containing my BB login info -> remove them manually

    @tfab69fr

    Member

    Thanks to Sam for these lines, I can use the $wpdb object in bbpress which is really great !

    if ( !defined( 'ABSPATH' ) ) {

    include_once( '/Full/Path/To/wp-load.php' );

    }

    Unfortunately there is a serious drawback as it breaks the translation of bbpress. The fr_FR.mo seems to have no effect with these line.

    Could you please help ?

    @sambauers

    Participant

    @tfab69fr

    I heard about this before, but no ticket was created.

    bbPress is supposed to merge in it’s language file into the existing array of languages from bbPress. Of course, that may not be happening as planned.

    Can you create a ticket with links to the language files you are using? http://trac.bbpress.org

    @jim-r

    Participant

    It seems whenever I use any ‘include’ statement, I get this type of error:

    Warning: include_once(/wpm/wp-load.php) [function.include-once]: failed to open stream: No such file or directory in /home/jwrbloom/public_html/wpm/bbpress/bb-config.php on line 4

    That’s what I’m getting now with what is recommended at the top.

    @chrishajer

    Participant

    That means you have the path to the file wrong and bb-config.php can’t find it. Try using the full /home/jwrbloom/public_html/wpm/wp-load.php path, from the root, not a relative path. Starting it with /wpm like that makes it SEEM like a full path.

    Or maybe you meant ../../wpm/wp-load.php for the relative path (up two directories)?

    @jim-r

    Participant

    The path to the file is accurate. Whenever I use an include, I get that error no matter how to designate the path.

    @kernpunt

    Member

    Has anyone actually got this working yet?

    I’m running bbpress 1.0.2 and the latest WordPress 2.8.2. User and cookie integration is working perfectly, but I’ve been trying to do a “deep integration” so that I can use WordPress’s templates.

    Whenever I try to include “wp-blog-header.php” in the config file like in past installations of bbpress, my forum spews a blank white page at me. I *know* that it’s finding the header file, because if I purposely change it to the wrong path, it’ll spew out an error at me.

    Just to try it, I’ve also attempted to include wp-load.php, wp-config.php, as well and have ended up with the same blank page every time. At first I suspected it may be a permalinks issue, but even after disabling that the blank page persisted.

    @rohan_kapoor

    Member

    Deep Integration is working fine for me. I have it running on several different sites, each with the latest versions. Here is one: http://wpmu.zyrot.com/forums/

    You could email me at rohan [at] rohan-kapoor.com and I could help you.

    @chrishajer

    Participant

    Kernpunt, the white screen is probably a 500 Internal Server error. Do you have access to logs or can you configure the server to show the errors so you can see what’s actually causing the problem? The blank page is just the visible symptom of the problem.

    @kernpunt

    Member

    I figured it out. I had access to the server logs, but they were still returning 200 ok and looked fine. After disabling plugins, it looks like WP-reCAPTCHA was conflicting with bbpress’s reCAPTCHA. I should have realized that, haha.

    @markus-pezold

    Participant

    Hi to all,

    is the problem with the language file within the deep integration fixed?

    Unfortunately there is a serious drawback as it breaks the translation of bbpress. The fr_FR.mo seems to have no effect with these line.

    My installation “forgot” some german words after the deep integration. Evtl. I must make a new ticket for these.

    Greetings

    Markus

    @markus-pezold

    Participant

    In the german bbpress board (http://support.bbpress.de/topic/installation-der-sprachdatei) i found for the language problem the following code:

    // Load the default text localization domain.

    if ( !(defined('DB_NAME')) ) { // Include localization the bbPress-way when WP is not running.

    load_default_textdomain();

    }

    else {

    $locale = get_locale();

    $mofile = BB_LANG_DIR . "$locale.mo";

    load_textdomain(‘default’, $mofile);

    };

    But this seems not to work with the new version. :(

    Markus

Viewing 25 replies - 1 through 25 (of 26 total)
  • You must be logged in to reply to this topic.
Skip to toolbar