WordPress.org

Support

Support » Plugins and Hacks » How to use 2 blogs with the same users.

How to use 2 blogs with the same users.

  • 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';

    Find:

    $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

    Davey

Viewing 15 replies - 1 through 15 (of 16 total)
  • JoelFalconer
    Member

    @joelfalconer

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

    Sorry, but i have really no idea.

    Hi
    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.
    http://hyperelektronik.com/down/

    davey579
    Member

    @davey579

    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.

    Can this also be made to work as one way access
    ie

    user from wp1 can access wp2

    but user from wp2 can not access wp1

    davey579
    Member

    @davey579

    I don’t think that is possible.

    jeasterling
    Member

    @jeasterling

    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.

    davey579
    Member

    @davey579

    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 😉 ).

    IzzyPop
    Member

    @izzypop

    Dave579

    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.

    Cheers

    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.

    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’;
    to
    $this->role_key = ‘wp_user_roles’;
    in wp-includes/capabilities.php then it should work.

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

    ParticularlyEvil
    Member

    @particularlyevil

    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.

    Frank

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

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘How to use 2 blogs with the same users.’ is closed to new replies.