The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

How to use 2 blogs with the same users. (17 posts)

  1. davey579
    Posted 9 years ago #

    I've read a few topics here about to share users with two wordpress installations, but there were problems with a 'You don't have permission...' message, I finally find out how you can solve this.

    So, how can you have the users of wordpress installation A too on wordpress installation B:

    Step 1
    The two installations should be in the same database, you can do this with the prefix options.

    The next steps are only for wordpress installation B:

    Step 2
    Find wp-settings.php, open it with a text-editor and find:

    $wpdb->users          = $wpdb->prefix . 'users';

    Change it to

    $wpdb->users          = 'wp_users';


    $wpdb->usermeta       = $wpdb->prefix . 'usermeta';

    Change it to:

    $wpdb->usermeta       = 'wp_usermeta';

    Step 3:

    Find wp-includes/capabilities.php, open it with a text-editor and find:

    $this->cap_key = $wpdb->prefix . 'capabilities';

    Change it to:

    $this->cap_key = 'wp_capabilities';

    Find all:

    $this->ID, $wpdb->prefix.'user_level'

    And change them to:

    $this->ID, 'wp_user_level'

    This steps will do the trick and you can now login on both wordpress installations with the same username and password.

    I don't know if it works with WordPress versions < 2.1


  2. JoelFalconer
    Posted 9 years ago #

    Will this work if I want an installation of WordPress MU to grab users from a standard WordPress installation?

  3. davey579
    Posted 9 years ago #

    Sorry, but i have really no idea.

  4. gevv
    Posted 9 years ago #

    my to make but problem :(

    ""WordPress database error: [Table 'hyper.wp_users' doesn't exist]
    SELECT * FROM wp_users WHERE user_login ='admin'""

    ""WordPress database error: [Table 'hyper.wp_users' doesn't exist]
    SELECT * FROM wp_users WHERE ID = '1' LIMIT 1"""

    please help me.

  5. davey579
    Posted 9 years ago #

    You're using the 2 wordpress installations in the same database? So you have a wordpress installation A and B.

    Now you have to find the table name of the users, usermeta etc.. from installation A (default: wp_users, wp_usermeta etc.. )

    The wp-settings.php of wordpress installation B should look like this (only for the users):

    $wpdb->users          = 'tablename of users from installation A';
    and so on for usermeta, capabilities and userlevel

    It has to work like this.

  6. gspark
    Posted 9 years ago #

    Can this also be made to work as one way access

    user from wp1 can access wp2

    but user from wp2 can not access wp1

  7. davey579
    Posted 9 years ago #

    I don't think that is possible.

  8. jeasterling
    Posted 9 years ago #

    This is a really good write-up. Can you tell me how to do this if my two (or my case 3) blogs are not on the same DB. I do not mind changing it to be on the same DB, but I do not want to loose any data in the process.

  9. davey579
    Posted 9 years ago #

    Well, that would be very difficult because it gets its settings from wp-config. So I think you have to get all your blogs in the same database (and remember: always make a backup ;) ).

  10. IzzyPop
    Posted 9 years ago #


    I have 7 blogs on a single database all of which I had previously edited the config.php and capabilities.php as you have stated above. I was wondering if you would know how to share the cookies from blog to blog so users are only required to log in once across all the blogs rather than having to log in as they navigate to each one.


  11. JCDerrick
    Posted 8 years ago #

    I have also installed WordPress in three directories and this has worked very well. The only glitch I've noticed is that the "Post Author" drop down box has disappeared when editing or managing a post.

    I suspect a field isn't looking at the proper user table in the database, but I have tried to find it with no avail. Does anyone have any idea where it might be? Or where the code is that controls those side menu items when managing a post?

    The "Post Author" block only appears on the initial WordPress installation. The two "children" tied to it both lack the post author block. That's why I'm fairly certain it's referencing the wrong table.

  12. WalletStation
    Posted 8 years ago #

    This fix didn't work for me for the latest WP. But if you follow the fix and also change

    $this->role_key = $wpdb->prefix . 'user_roles';
    $this->role_key = 'wp_user_roles';
    in wp-includes/capabilities.php then it should work.

  13. Anonymous
    Posted 8 years ago #

    I can't get this to work on the latest release. Any help?

  14. Anonymous
    Posted 8 years ago #

  15. ParticularlyEvil
    Posted 8 years ago #

    For those of you that miss your "Post Author" drop down menu, I have found the fix.

    Go to wp-admin/admin-db.php

    Find all:
    $level_key = $wpdb->prefix . 'user_level';

    and replace with:
    $level_key = 'wp_user_level';

    There are several replacements of this term in that file.
    That should do it.


  16. jeffwong
    Posted 8 years ago #

    I follow the all steps above but still got same error
    Then I solve it follow this post

  17. geckospyker
    Posted 8 years ago #

    It took me a few times of running davey579's hack in conjunction with the suggestion posted by jstroh to get this right.

    I had a fairly new installtion of WP 2.3.3 and wanted to install a few more. Since the topics are marginally related it sounded like a good idea to use a common user table for user and usermeta info. So, jstroh, I did follow your post! Very helpful indeed. I followed the modifications for wp_config to define the custom table (it didn't work at first, but it could've been me). Then I followed steps 2 and 3 from davey579's post. After which I followed the suggestion from DKN's post.

    As for the PostAuthor problem I did not find a wp-admin/admin-db.php in the WP 2.3.3 installation files. Is there any other file that for the v2.3.3 that will solve this? I tried to search the files, but didn't come up with anything.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.