Integrate wp and bbpress registration
-
Registration in WP should be registration on bbpress, so bbpress will use wp_users in wordpress database.
When login through wp-login.php, automatically login at bbpress
So I made some changes in my config.php (bbpress file) and in wp-config.php (wp file)
They are:
config.php
<?php
require_once('/home/........................./public_html/wp-blog-header.php');
// ** MySQL settings ** //
define('BBDB_NAME', 'xxx'); // The name of the database
define('BBDB_USER', 'xxx'); // Your MySQL username
define('BBDB_PASSWORD', 'xxx'); // ...and password
define('BBDB_HOST', 'localhost'); // 99% chance you won't need to change this value
define('CUSTOM_USER_TABLE', 'wp_users');
define('CUSTOM_USER_META_TABLE', 'wp_usermeta');
// Change the prefix if you want to have multiple forums in a single database.
$bb_table_prefix = 'bb_'; // Only letters, numbers and underscores please!
// If your bbPress URL is http://bbpress.example.com/forums/ , the examples would be correct.
// Adjust the domain and path to suit your actual URL.
// Just the domain name; no directories or path. There should be no trailing slash here.
$bb->domain = ‘http://site.ru’; // Example: ‘http://bbpress.example.com’
// There should be both a leading and trailing slash here. ‘/’ is fine if the site is in root.
$bb->path = ‘/forum/’; // Example: ‘/forums/’
// What are you going to call me?
$bb->name = ‘Форум’;
// This must be set before running the install script.
$bb->admin_email = ‘admin@site.ru’;
// Set to true if you want pretty permalinks.
$bb->mod_rewrite = true;
// The number of topics that show on each page.
$bb->page_topics = 30;
// A user can edit a post for this many minutes after submitting.
$bb->edit_lock = 60;
// Your timezone offset. Example: -7 for Pacific Daylight Time.
$bb->gmt_offset = 0;
// Change this to localize bbPress. A corresponding MO file for the
// chosen language must be installed to bb-includes/languages.
// For example, install de.mo to bb-includes/languages and set BBLANG to ‘de’
// to enable German language support.
define(‘BBLANG’, ”);
// Your Akismet Key. You do not need a key to run bbPress, but if you want to take advantage
// of Akismet’s powerful spam blocking, you’ll need one. You can get an Akismet key at
// http://wordpress.com/api-keys/
$bb->akismet_key = false;
// 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 = ‘http://site.ru’; // WordPress – Options->General: Blog address (URL) // No trailing slash
$bb->wp_siteurl = ‘http://site.ru’; // WordPress – Options->General: WordPress address (URL) // No trailing slash
/* Stop editing */
/**************************
* Start WP integration
**************************/
// My bbpress is in a subdirectory of my WP install… must bew a nicer way of doing this??
if(file_exists(“../wp-settings.php”))
{
// loads the functions and wp config
require_once “../wp-config.php”;
require_once “../wp-settings.php”;
// use the WP user table for your bbpress user list
define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
// your $bb->domain must match your wp domain exactly or the hash won’t work and users will not authenticate.
$myhash = md5($bb->domain);
$bb->usercookie = ‘wordpressuser_’ . $myhash;
$bb->passcookie = ‘wordpresspass_’ . $myhash;
// Use the same cookie as WP
$bb->cookiepath = ‘/’;
}
/**************************
* End WP integration
**************************/
define(‘BBPATH’, dirname(__FILE__) . ‘/’ );
require_once( BBPATH . ‘bb-settings.php’ );
?>
And I add in wp-config.php:
// Cookies, bbPress fix
$bb->cookiedomain = 'localhost';
$bb->cookiepath = '/';
I register new user in worpdress and then go to my bbpress.
Bbpress says my “user not found”
What is my mistake?
The topic ‘Integrate wp and bbpress registration’ is closed to new replies.
