WordPress.org

Ready to get started?Download WordPress

Forums

WordPress and bbPress Integration (47 posts)

  1. driz
    Member
    Posted 5 years ago #

    Hi, I have just installed both WP and bb at http://www.paperviewzine.com/ and http://forums.paperviewzine.com/ and I have integrated the two. I have installed the bbPress integration plugin for WP and done all the salts and auth keys in the config files as well as adding the cookie info created by the plugin mentioned.

    However it does not seem to be working. When I login into one, I am automatically logged out of the other, and when logged into bb i am unable to login back into WP as it just refreshes the login page and does show any messages or anything, I am then forced to reset the browser cookies/cache to get back in. Edit, seems i dont have to reset the browser at all, i logged out of bb and when i came back to WP i was logged in, so it would seem i was in fact logged in, but the cookies are not working correctly so WP and bb are not understanding that i am logged in when im logged into the other.

    Any ideas how I can fix this? The user system is working as I have created accounts in WP and they appear in bb so that part works correctly. It is just the cookies that refuse to work as intended. And I have double check the salts via phpMyAdmin and they are the same in both wp_options and bb_metas.

    Any help at all would be appreciated. Thanks

  2. joshmac
    Member
    Posted 5 years ago #

    Do you have something like this in your wp-config.php file?

    define( 'COOKIEHASH', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
    $wp->cookiedomain = '.example.com';
    define('COOKIE_DOMAIN', '.example.com');
    $wp->cookiepath = '/';
    $wp->sitecookiepath = '/';
    define('COOKIEPATH', '/' );
    define('SITECOOKIEPATH', '/');

    And this in your bb-config.php file?

    $bb->wp_siteurl = 'http://example.com';
    $bb->wp_home = 'http://example.com';
    $bb->wp_table_prefix = 'wp_';
    $bb->user_bbdb_name = 'word_database';
    $bb->user_bbdb_user = 'word_user';
    $bb->user_bbdb_password = 'xxxxxxxx';
    $bb->user_bbdb_host = 'localhost';
    $bb->custom_user_table = 'wp_users';
    $bb->custom_user_meta_table = 'wp_usermeta';
    $bb->authcookie = 'wordpress_XXXXXXXXXXXXXXXXXXXXXXXX';
    $bb->cookiedomain = '.example.com';
    $bb->cookiepath = '/';
    $bb->sitecookiepath = '/';

    As well as this at the end of your bb-config.php file?
    $bb->bb_xmlrpc_allow_user_switching = true;

  3. driz
    Member
    Posted 5 years ago #

    Whoah where did all that code come from? I haven't got any of that code apart from
    define('COOKIE_DOMAIN', '.paperviewzine.com');
    define('COOKIEPATH', '/' );
    inside my wp-config.php file.

    Where did you get all that from? I haven't seen any of that code mentioned in the bbPress documentation or the bbPress admin screen for integration. What is the XXXXXXXXXXXXXXXXX what goes in the those? It seems to me like you have done the integration totally different to what is explained in the Documentation, are you using the integration plugin, from what I can tell from that code, your ignoring the inbuilt system and linking direct to WordPress using the config file.

    I'm using the latest versions of both WordPress and bbPress, so I'm not sure if that code is the old way of doing the integration or if your just doing things differently. Can you please explain thanks.

  4. driz
    Member
    Posted 5 years ago #

    What is the difference between the code in the config file and the code in the database, I just realized that that the code above is the advanced settings in bbPress right? BUT it saves it in the DB not in the config file!

  5. joshmac
    Member
    Posted 5 years ago #

    Someone at the BBpress forums wrote a tutorial about this a while ago. Not sure who and not sure if it can still be found. I have been using it for all my installations, and have had perfect integration as well as having the admin user from WordPress be the Keymaster upon install and deep integration. Actually, I found that post that used to be a stickie. This code might not be needed with the stable release of 1.0, but I still use it just in case.

    Documentations are not usually concise and some of the code I use is for backwards compatibility.

  6. driz
    Member
    Posted 5 years ago #

    I have everything the exact same as each other in both the wp-config and bb-config:
    BUT it still does not work, any ideas why?

    <?php
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information by
     * visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'db52704_database1');
    
    /** MySQL database username */
    define('DB_USER', 'db52704');
    
    /** MySQL database password */
    define('DB_PASSWORD', '##########');
    
    /** MySQL hostname */
    define('DB_HOST', 'internal-db.s52704.gridserver.com');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /**#@+
     * Authentication Unique Keys.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define('AUTH_KEY', 'cloud');
    define('SECURE_AUTH_KEY', 'strife');
    define('LOGGED_IN_KEY', 'rufus');
    define('NONCE_KEY', 'shinra');
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wppaperview_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress.  A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
     * language support.
     */
    define ('WPLANG', '');
    
    /* That's all, stop editing! Happy blogging. */
    
    /** WordPress absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    
    //define( 'COOKIE_DOMAIN', '.paperviewzine.com' );
    //define( 'COOKIEPATH', '/' );
    
    define( 'COOKIEHASH', 'wordpress_8e72683dbbeebc073cf684080993eebc' );
    $wp->cookiedomain = '.paperviewzine.com';
    define('COOKIE_DOMAIN', '.paperviewzine.com');
    $wp->cookiepath = '/';
    $wp->sitecookiepath = '/';
    define('COOKIEPATH', '/' );
    define('SITECOOKIEPATH', '/');

    and then my bbpress config:

    <?php
    /**
     * The base configurations of bbPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys and bbPress Language. You can get the MySQL settings from your
     * web host.
     *
     * This file is used by the installer during installation.
     *
     * @package bbPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for bbPress */
    define( 'BBDB_NAME', 'db52704_database1' );
    
    /** MySQL database username */
    define( 'BBDB_USER', 'db52704' );
    
    /** MySQL database password */
    define( 'BBDB_PASSWORD', '##########' );
    
    /** MySQL hostname */
    define( 'BBDB_HOST', 'internal-db.s52704.gridserver.com' );
    
    /** Database Charset to use in creating database tables. */
    define( 'BBDB_CHARSET', 'utf8' );
    
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'BBDB_COLLATE', '' );
    
    /**#@+
     * Authentication Unique Keys.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/bbpress/ WordPress.org secret-key service}
     *
     * @since 1.0
     */
    define( 'BB_AUTH_KEY', 'cloud' );
    define( 'BB_SECURE_AUTH_KEY', 'strife' );
    define( 'BB_LOGGED_IN_KEY', 'rufus' );
    define( 'BB_NONCE_KEY', 'shinra' );
    /**#@-*/
    
    /**
     * bbPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $bb_table_prefix = 'bb_';
    
    /**
     * bbPress Localized Language, defaults to English.
     *
     * Change this to localize bbPress. A corresponding MO file for the chosen
     * language must be installed to a directory called "my-languages" in the root
     * directory of bbPress. For example, install de.mo to "my-languages" and set
     * BB_LANG to 'de' to enable German language support.
     */
    define( 'BB_LANG', '' );
    require_once('/home/52704/domains/paperviewzine.com/html/wp-blog-header.php');
    
    $bb->wp_siteurl = 'http://www.paperviewzine.com';
    $bb->wp_home = 'http://www.paperviewzine.com';
    $bb->wp_table_prefix = 'wppaperview_';
    $bb->user_bbdb_name = 'db52704_database1';
    $bb->user_bbdb_user = 'db52704';
    $bb->user_bbdb_password = '##########';
    $bb->user_bbdb_host = 'internal-db.s52704.gridserver.com';
    $bb->cookiedomain = '.paperviewzine.com';
    $bb->cookiepath = '/';
    $bb->sitecookiepath = '/';
    $bb->authcookie = 'wordpress_8e72683dbbeebc073cf684080993eebc';
    
    ?>
  7. driz
    Member
    Posted 5 years ago #

    I decided to delete my bbPress installation and reinstall it using the BUILT-IN settings for integration. It works perfect apart from one part, when I'm logged in one app I'm not logged into the other and it won't let me login to the other UNTIL I have logged out of the other. Any ideas?

  8. joshmac
    Member
    Posted 5 years ago #

    Did you add this at the end of your bbpress config file?
    $bb->bb_xmlrpc_allow_user_switching = true;

    Also, at the top of that same file it is better to put this

    if ( !defined( 'ABSPATH' ) & !defined( 'XMLRPC_REQUEST' )) {
        define( 'WP_USE_THEMES', false );
        //
        //  You will need to get the ABSOLUTE path to this file |
        //                                                     \|/
        require_once( '/home/52704/domains/paperviewzine.com/html/wp-load.php' );
        header( "HTTP/1.1 200 OK" );
        header( "Status: 200 All rosy" );
    }

    Instead of this

    require_once('/home/52704/domains/paperviewzine.com/html/wp-blog-header.php');

    I have issues logging into bbpress and then having it carry over to wordpress. But as long as a user can log into wordpress and then carry over to bbpress, then that is ok for me. With deep integration, one can use replace bbpress login form with wordpress login form.

    Lastly, you need to place your bbpress keys from your bb-config.php file into your wp-config.php file.

  9. driz
    Member
    Posted 5 years ago #

    Done all that but still not working :/

    I took a look at the cookies in my browser and noticed that some start with .paperviewzine.com and some just paperviewzine.com is this whats causing the problem? I noticed on WordPress.org they are just .wordpress.org and .bbpress.org so it seems like the likely culprit, how can i fix this?

    IMAGE HERE: http://paperviewzine.com/cookies.png

  10. joshmac
    Member
    Posted 5 years ago #

    And you have your WordPress keys in your bb-config.php file as well? The other thing to do is clear your cookies, restart your browser, and try again. BTW...never post your wordpress or bbpress keys; that is a security risk to you.

    Once your restart, then check your Safari cookies again and see if your domain is coming up with the "." or not. If it is not, then change your cookiedomain to "example.com" or try "www.example.com".

  11. driz
    Member
    Posted 5 years ago #

    Yes I have the keys in both wp-config and bb-config! And I have restarted the browser several times. But for some reason it creates cookies for .paperviewzine.com and paperviewzine.com :/ I'm guessing that is the problem?

  12. joshmac
    Member
    Posted 5 years ago #

    I meant to say clear you cache, but I think you knew what I meant. Hmmm, that is just strange, I need to check on something.

  13. driz
    Member
    Posted 5 years ago #

    Yeah the reset clears everything cache, cookies, etc. But still its not working properly :/

    Look forward to your ideas. Thanks

  14. joshmac
    Member
    Posted 5 years ago #

    The dot or missing dot is not the issue. It will usually show up both ways, but your backend cookies for both wordpress and bbpress will be with the dot. Ok, just want to go over some other things that wasn't mentioned. You enabled XML-RPC in WordPress and BBpress; you set up your roles in bbpress; and you've setup the keymaster; and the wordpress integration settings in bbpress?

  15. driz
    Member
    Posted 5 years ago #

    Yes to all of the above! The user tables are linked, in fact their is only the WP user tables and that part works fine. The only thing that isn't working is the cookies.

  16. joshmac
    Member
    Posted 5 years ago #

  17. driz
    Member
    Posted 5 years ago #

    Yes I have that plugin installed. What about the salts? Do they need adding to the config files? I havent seen any mention of it, just adding them to the input fields INSIDE the bbPress WP-Integration options.

  18. joshmac
    Member
    Posted 5 years ago #

    I believe they said the salts are used when you are using an ssl enabled site. I usually include them but don't know if that makes a difference.

  19. driz
    Member
    Posted 5 years ago #

    When I log into bbPress I am logged into WordPress, BUT looking at my cookies the URLS are incorrect, they show two cookies //wp-admin/ and //wp-content/plugins so when I visit the Admin page of WordPress i am NOT logged in, but if I change the URL to //wp-admin it will work, I have looked all over to see if their is a reason why it is adding double // but their is no reason for it.

    I should also note that logging into WordPress does not have me logged into bbPress at all, I have to manually log into bbPress as well. So its half working, but what does work is also working weirdly.

  20. joshmac
    Member
    Posted 5 years ago #

    You are using a subdomain for your forum, right? I am not sure if that is the issue or not. People have been having problems with subdomain installations. Make sure that everywhere you enter your site url and blog url for WordPress, that it does not have the trailing slash "/"; that would be in the backend settings, and your config files. Because of your subdomain setup, I am not sure if the forum url should have a trailing slash or not. These are a few things to try out or consider.

  21. driz
    Member
    Posted 5 years ago #

    WordPress and bbPress automatically re-add the / if you remove it!

  22. joshmac
    Member
    Posted 5 years ago #

    Wow, then I am completely lost. I think that this is where the double trailing slash is coming from. My only other suggestion is to check out the bbpress forum. People have been having success by using this guys guide, but then again, it is not a subdomain installation.

  23. driz
    Member
    Posted 5 years ago #

    Right! I have moved my forums to http://paperviewzine.com/forums/ and NOW the cookies are working correctly. So it would seem bbPress and WordPress don't work when on different sub-domains. However the bbPress login is still spitting out the double trailing slash which then breaks the logged in status for WordPress.

  24. driz
    Member
    Posted 5 years ago #

    Turns out the cookiepath needs to be blank and all works fine, even so all the docs insist on putting a / as the path. it actually creates duplicate // so thats the problem. Not sure if that was what was breaking the subdomain as well, but its all working now.

    Thanks for all your help pal.

    EDIT: Spoke too soon, the logout links arn't logging me out! Any ideas why ?? :/
    EDIT 2: Right fixed it, deleting the whole of the cookie path and cookie domain fixes all the problems, so the documentations are wrong in saying you need those lines of code, adding them breaks it!

  25. joshmac
    Member
    Posted 5 years ago #

    Glad that you finally got it working. One day I will take a gander at the subdomain installation to see if I can get it to work.

  26. Ovidiu
    Member
    Posted 5 years ago #

    can I throw in a question myself, please?

    I have successfully integrated bbpress 1.0.1 with wpmu 2.8.3 and all is working well except for one small issue:

    users who sign up on the wpmu side, are not activated in bbpress even though I have configured it thus, that all groups should become members on the bbpress side.

    so I have ot manually go to the bbpress admin panel for each new user that signs up and make them a member manually :-(

    any idea what I could check here?

  27. mjjinvincible
    Member
    Posted 5 years ago #

    Hi parkstreet,
    first of all thank you for replying me and leading me here.
    I've tried everything you say over here...

    Putting the code in the bb-config.php and wp-config.php files
    Enableing the XML-RPC thing
    Tried also what works for driz, leaving blank the cookiepath, and deleting the cookie path and cookie domain lines... but still it's not working. It ALWAYS redirects me to wp-login.php when trying to access WordPress admin panel (after loggin in bbPress in the first place).

  28. joshmac
    Member
    Posted 5 years ago #

    @Ovidiu, I am not sure if it is a bug or if this is the normal behavior, but I've noticed that as well. I think as long as you can see them in bbpress, that should be ok. What I've noticed is that when a user logs into WordPress, then the "Inactive" status becomes "Member", or if they log in and then visit the forum, their "Inactive" status gets set to "Member." Like I said, I am not sure if this is a bug or normal behavior. This is a behavior for current members when you first install bbpress. But it seems like you are having this behavior after the fact. If that is the case, then I am not sure where the issue lies.

    @mjjinvincible, have you tried clearing your cache and restarting your browser. And you are not using a subdomain for your forum, right?

  29. joshmac
    Member
    Posted 5 years ago #

    Someone mentioned a plugin that can be created and dropped into mu-plugins that would take care of the role issue.

  30. pasmith
    Member
    Posted 5 years ago #

    Hey all, I'm running into a similar problem and it sure seems to be cookie related.

    Setup is:

    blog at http://mydomain.com
    forums at http://forum.mydomain.com

    If I log into wordpress then check out my cookies I see the host as

    mydomain.com

    no leading .

    If I jump over to bbPress, I'm not logged in. If I edit the cookie and put a . in the domain:

    .mydomain.com

    then reload the forum page, I'm logged in. Oddly, if I log into bbPress first, then wordpress reads me as logged in with no fiddling.

    In wp-config I have:

    define( 'COOKIE_DOMAIN', '.mydomain.com' );

    But it seems like wordpress is disregarding that leading period.

    Any ideas?

    UPDATE: It looks to me like that define statement isn't doing anything. For grins I changed the domain to foo.com and I still got mydomain.com in the cookie.

Topic Closed

This topic has been closed to new replies.

About this Topic