[bbDev] Cookie Sharing with Wordpress not Carrying Through to Admin (bb_config.php & .htaccess)

Tom Claessens whistlerke at gmail.com
Sat May 6 07:38:45 GMT 2006


since you required wp-config.php (actually, you don't need to require
wp-settings.php, it's required in wp-config), you can use the wp variables.
So, I would do something like this:

if(file_exists('../wp-config.php')) {
define('BBDB_NAME', WPDB_NAME); //or whatever wp's constant is... note there
are no ' ' arount WPDB
...
$bb = $wp; //not sure this will work :) otherwise you will have to set the
variables manually:
$bb->domain = $wp->domain; //this is why your cookie didn't work: you hashed
your $bb->domain, which is another domain than your wp install, and thus
another cookie :)

define('CUSTOM_USER_TABLE', 'wp_users');
define('CUSTOM_USER_META_TABLE', 'wp_usermeta');

[bla bla bla]

} else {
[the original content of your bb-config.php
}

greetz,

tom

On 5/5/06, Harvey Ramer <harvey.ramer at designdelineations.com> wrote:
>
> My config file looks like this:
>
>
> <?php
> // ** MySQL settings ** //
> define('BBDB_NAME', '');     // The name of the database
> define('BBDB_USER', ');     // Your MySQL username
> define('BBDB_PASSWORD', 't'); // ...and password
> define('BBDB_HOST', 'localhost');     // 99% chance you won't need to
> change
> this value
>
> // Change the prefix if you want to have multiple forums in a single
> database.
> $bb_table_prefix  = 'bb_';
>
> $bb->domain = 'http://forums.skepticfaith.com'; // There should be no
> trailing slash here.
> $bb->path   = '/';                      // There should be both a leading
> and trailing slash here. '/' is fine.
> $bb->name   = 'Skeptic Faith Forums';
>
> $bb->admin_email = 'harvey.ramer at skepticfaith.com';
> $bb->mod_rewrite = true;
> $bb->page_topics = 30;
>
> // Number of minutes after posting a user can edit their post
> $bb->edit_lock = 60;
>
> $bb->gmt_offset = -5;
> /* 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"))
> {
> //echo "using wordpress functions";
>   // 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');
> //define('CUSTOM_USER_META_TABLE', 'wp_usermeta');
>
>   // 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' );
> ?>
>
> Here's my .htaccess file
> ******************************************************* .htaccess
> *************************************************
>
> # BEGIN bbPress
> Options +FollowSymLinks
> RewriteEngine on
>
> RewriteRule ^forum/(.+)/page/?([0-9]{1,})/?$ forum.php?id=$1&page=$2
> [QSA,L]
> RewriteRule ^forum/(.+)/?$ forum.php?id=$1 [QSA,L]
> RewriteRule ^profile/(.+)/(edit|favorites)/?$ profile.php?id=$1&tab=$2
> [QSA,L]
> RewriteRule ^profile/(.+)/?$ profile.php?id=$1 [QSA,L]
> RewriteRule ^rss/forum/(.+)/?$ rss.php?forum=$1 [QSA,L]
> RewriteRule ^rss/profile/(.+)/?$ rss.php?profile=$1 [QSA,L]
> RewriteRule ^rss/tags/(.+)/?$ rss.php?tag=$1 [QSA,L]
> RewriteRule ^rss/topic/(.+)/?$ rss.php?topic=$1 [QSA,L]
> RewriteRule ^rss/view/(.+)/?$ rss.php?view=$1 [QSA,L]
> RewriteRule ^rss/?$ rss.php [QSA,L]
> RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ search.php?q=$1&page=$2
> [QSA,L]
> RewriteRule ^search/(.+)/?$ search.php?q=$1 [QSA,L]
> RewriteRule ^tags/(.+)/page/?([0-9]{1,})/?$ tags.php?tag=$1&page=$2
> [QSA,L]
> RewriteRule ^tags/(.+)/?$ tags.php?tag=$1 [QSA,L]
> RewriteRule ^tags/?$ tags.php [QSA,L]
> RewriteRule ^topic/(.+)/page/?([0-9]{1,})/?$ topic.php?id=$1&page=$2
> [QSA,L]
> RewriteRule ^topic/(.+)/?$ topic.php?id=$1 [QSA,L]
> RewriteRule ^view/(.+)/page/?([0-9]{1,})/?$ view.php?view=$1&page=$2
> [QSA,L]
> RewriteRule ^view/(.+)/?$ view.php?view=$1 [QSA,L]
>
> # END bbPress
>
>
>
> RewriteCond %{HTTP_HOST} ^forums.scepticfaith.com$ [OR]
> RewriteCond %{HTTP_HOST} ^www.forums.scepticfaith.com$
> RewriteRule ^(.*)$ http://forums.skepticfaith.com [R=301,L]
>
>
>
> RewriteCond %{HTTP_HOST} ^forums.scepticalfaith.com$ [OR]
> RewriteCond %{HTTP_HOST} ^www.forums.scepticalfaith.com$
> RewriteRule ^(.*)$ http://forums.skepticfaith.com [R=301,L]
>
> RewriteCond %{HTTP_HOST} ^forums.skepticalfaith.com$ [OR]
> RewriteCond %{HTTP_HOST} ^www.forums.skepticalfaith.com$
> RewriteRule ^(.*)$ http://forums.skepticfaith.com/$1 [R=301,L]
>
> -----Original Message-----
> From: Harvey Ramer [mailto:harvey.ramer at designdelineations.com]
> Sent: Friday, May 05, 2006 3:39 PM
> To: 'bbPress Development'
> Subject: [bbDev] Cookie Sharing with Wordpress not Carrying Through to
> Admin
>
>
> Here's my setup:
>
> In the site root, I have Wordpress
> in /forums/, I have bbPress but it is accessed by forums.domain.com
>
> User capabilities are transferring fine between software packages, but
> cookie authentication does not seem to work for the admin area. I disabled
> the security redirect and tested for cookies but to no avail.
>
> What am I missing?
>
>
> Harvey Ramer
>
> -------------------------------------------------
> Design Delineations
> 4 Prospect Street
> Norwood, NY 13668
> Toll Free: (866)-874-8710
> Phone:(315)-262-0469
> Fax: (315)-262-0448
> <http://www.designdelineations.com/> http://www.designdelineations.com
> Complete Web Solutions. Personal Service.
> -------------------------------------------------
>
> Confidentiality Notice:  This e-mail message, including any attachments,
> is
> for the sole use of the intended recipient(s) and may contain confidential
> and privileged information.  Any unauthorized review, use, disclosure, or
> distribution is prohibited.  If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message.
>
>
>
> _______________________________________________
> bbDev mailing list
> bbDev at lists.bbpress.org http://lists.bbpress.org/mailman/listinfo/bbdev
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006
>
>
>
> _______________________________________________
> bbDev mailing list
> bbDev at lists.bbpress.org
> http://lists.bbpress.org/mailman/listinfo/bbdev
>


More information about the bbDev mailing list