[wp-trac] [WordPress Trac] #3439: Capabilities on mulitple installs sharing usermeta table

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 5 20:19:42 GMT 2006

#3439: Capabilities on mulitple installs sharing usermeta table
 Reporter:  Kafkaesqui      |       Owner:  anonymous                        
     Type:  defect          |      Status:  new                              
 Priority:  normal          |   Milestone:  2.0.6                            
Component:  Administration  |     Version:  2.0.5                            
 Severity:  normal          |    Keywords:  capabilities roles users usermeta
 One can run multiple instances of WordPress off a single users table (by
 defining the  CUSTOM_USER_TABLE constant), but at present it doesn't quite
 work for usermeta (with CUSTOM_USER_META_TABLE).

 The issue as I see comes down to a line in the WP_User function (WP_User
 class in capabilities.php):

 $this->cap_key = $table_prefix . 'capabilities';

 As $table_prefix holds the value of the current weblog's table prefix,
 this invalidates role lookups in the ''primary'' usermeta table, which
 uses the primary weblog's table prefix for the 'capabilities' meta_key.

 I'm fishing to see what might be the best solution. At the moment I'm
 thinking adding a new constant to the mix:

 define('PSEUDO_TABLE_PREFIX', 'wp_');

 and testing for it in capabilities.php:

 if ( defined('PSEUDO_TABLE_PREFIX') )
         $this->cap_key = PSEUDO_TABLE_PREFIX . 'capabilities';
         $this->cap_key = $table_prefix . 'capabilities';

 is the way to go, but it feels a bit hacky.

 Related tickets:[[BR]]
 http://trac.wordpress.org/ticket/2378 [[BR]]

Ticket URL: <http://trac.wordpress.org/ticket/3439>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list