Support » Fixing WordPress » multiple blogs / single users table – stuck on user_level

  • Hi,

    I have been trying to install two blogs (one in English and a mirror in the local language) which use the same users table.

    My first attempt was to go to wp_settings.php of the mirror and replace:

    $wpdb->users = $table_prefix . ‘users’;
    $wpdb->usermeta = $table_prefix . ‘usermeta’;
    $wpdb->users = ‘master_users’;
    $wpdb->usermeta = ‘master_usermeta’;

    Having done so I was able to log in on both blogs using the administrator password of the master blog, however I was not given any rights on the slave blog, so I couldn’t write or administer anything.

    I then replaced the original settings file and tried plan B: defining CUSTOM_USERS_TABLE and CUSTOM_USER_META_TABLE in the wp-config.php file, like so:

    define(‘CUSTOM_USER_TABLE’, ‘master_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘master_usermeta’);

    As far as I could tell, this gave the same results as my first attempt: I could log in, but it didn’t do me any good.

    A search of the forum turned up the following:

    Here the solution looks alot like my Plan B, but with the definition placed in wp-settings.php above the ‘if’ statements, like so:

    define(‘CUSTOM_USER_TABLE’, ‘master_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘master_usermeta’);

    if ( defined(‘CUSTOM_USER_TABLE’) )
    $wpdb->users = CUSTOM_USER_TABLE;
    if ( defined(‘CUSTOM_USER_META_TABLE’) )
    $wpdb->usermeta = CUSTOM_USER_META_TABLE;

    This gave the same results as both of my first attempts, and I have been unable to find a satisfactory solution to this.

    My suspicion is that the ‘prefix’ . ‘user_level’ is to blame: In the users_meta table the user_level is given the same prefix as the table, which I imagine means that when my slave blog is looking for slave_user_level, all it is finding is master_user_level.

    Is there a work-around which doesn’t involve finding and replacing all the instances of ‘prefix’ . ‘user_level’ in wordpress and potentially wreaking havoc?

    Could my suspicion be wrong? (I am hoping that this is the case, because it would probably simplify matters greatly!).

    I would be grateful for any suggestions or pointers!

    With kind regards,
    Kat, the Twat

  • The topic ‘multiple blogs / single users table – stuck on user_level’ is closed to new replies.