[bbDev] WordPress and BBPress Shared Users

Derek Winterstien wordpressforum at robotz.com
Fri Oct 14 02:30:51 GMT 2005


I've been investing a considerable amount of time lately getting BBPress 
configured for integration with my WordPress site, including sharing the 
wp_users table.  As a guide I've worked off of Michael D Adams post
http://comox.textdrive.com/pipermail/bbdev/2005-August/000227.html

WordPress 1.5 will accept users who register with a space in their 
username.  BBPress doesn't like this, thus breaking forum access for any 
user with a space in the username. This is a problem visible when I echo 
the select statement and see the username without the space. For 
example: WP user "Bart Simpson" becomes BartSimpson, thus not matching 
the WordPress username.

My primary struggle has been with bb_usermeta.  As stated in the afore 
mentioned thread, WordPress 1.5 has no usermeta table.  With the 
usermeta data absent users lack $capabilities and therefore cannot post 
new threads or topics to the forum.  This is true for users who register 
to the WordPress site.  The function bb_append_meta( $object, $type ) in 
functions.php is important as it is where the SELECT from usermeta takes 
place.  I've tried to make the default "member" with no success.

Manually adding the usermeta capabilities to satisfy 
bb_current_user_can($capability) in the usermeta table for each new 
registered user is cumbersome and impractical for an active site.

Modifying the WordPress code, which adds new users to the database, is 
undesirable for a number of reasons including it handicaps WP upgrading 
and would require all code modified for modify and deleting users.

I would prefer that if the metadata were absent, the default would be 
the "member" capabilities so users could post topics and threads.

So I've worked on functions.php : bb_append_meta

I think this is the target code:
                         foreach ( $metas as $meta ) :
                                 $object->{$meta->meta_key} = 
cast_meta_value( $meta->meta_value );
                                 if ( strpos($meta->meta_key, 
$bb_table_prefix) === 0 )
 
$object->{substr($meta->meta_key, strlen($bb_table_prefix))} = 
cast_meta_value( $meta->meta_
                         endforeach;

I'm learning OOP programming (I'm an old school traditional procedural 
programmer) and I am struggling to get the default capabilities options 
assigned when no meta is present for new users.

sample="a:1:{s:6:\"member\";b:1;";

Maybe there is an easier way to set the default capabilities allowing 
post and other capabilities attributed to "member" class users.  That's 
what I am asking for help on.  Thanks!




More information about the bbDev mailing list