Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying out the SharDB plugin, but it doesn't seem to be respecting my CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE declarations -- it is querying $shardb_prefix.users instead of my custom table name. Anyone know if this plugin is supposed to support the CUSTOM_USER_TABLE definitions?

Thanks!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Ok, looking into this, I found a little bug in the tables function (beginning on line 1088) in the db.php script file that comes with SharDB.

It was this bit of code that was the problem (starting on line 1114 of db.php):

if ( isset( $tables['users'] ) ) {
    if( defined( 'CUSTOM_USER_TABLE' ) ) 
        $pre_tables['users'] = CUSTOM_USER_TABLE;
    if ( defined( 'CUSTOM_USER_META_TABLE' ) ) 
        $pre_tables['usermeta'] = CUSTOM_USER_META_TABLE;
}

See, it does check before it returns the tables list to see if CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE are defined, and overwrites the default values if they are. However the check was not running in the first place because of the isset( $tables['users'] ) check on line 114. $tables is an array of table names, 'users' is one of the values in the array, so $tables['users'] is never set.

So change line 114 to:

if ( isset( $pre_tables['users'] ) )

and voila. You're all set

(I'm gonna go find the plugin author now and report the bug!)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.