Forums

Want to Join Two Different WP Tables (9 posts)

  1. kzq
    Member
    Posted 3 weeks ago #

    I am running two WP blogs and I want to join WP_Users table with each other. I tried following MySQL Query in PhpmyAdmin but facing error #1052 - Column 'user_login' in field list is ambiguous

    Can anyone guide me how can I join WP_Users tables from two different WP with each other at same server, because I want single user login for both blogs

    SQL Query

    SELECT first_db.wp_users.ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name,
    second_db.wp_users.ID, c.user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name
    FROM first_db.wp_users LEFT JOIN second_db.wp_users
    ON
    (
    first_db.wp_users.ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name = second_db.wp_users.ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name
    );

  2. stvwlf
    Member
    Posted 3 weeks ago #

    Share users between two blogs
    Put them both in the same database with different prefixes. Then choose one of them to be the master user table. Then do this in both wp-config.php files:

    define(CUSTOM_USER_TABLE,'wp_users');
    define(CUSTOM_USER_META_TABLE,'wp_usermeta');

    Replace the wp_ with the prefix you want.

    In other words, designate the user table from one installation as the master user table which will be used by the other installations instead of their own user table. This PHP code must go in the wp-config.php file in all the installations that you want sharing a single user table. You can have more than two installations set up the same way. Their tables must all be in a single database however.

  3. kzq
    Member
    Posted 3 weeks ago #

    I am facing error "You do not have sufficient permissions to access this page." after adding these two lines

    define(CUSTOM_USER_TABLE,'wp_users');
    define(CUSTOM_USER_META_TABLE,'wp_usermeta');

    $table_prefix = 'envideo_';

    didn't worked
    http://wpclassipress.com/forum/viewtopic.php?f=11&t=1409

  4. stvwlf
    Member
    Posted 3 weeks ago #

  5. kzq
    Member
    Posted 3 weeks ago #

    Thanks Stvwlf I found the solution but there were so many limitations. I am operating 5 WP with more than 4,000 posts and its impossible to reinstall all my blogs or to use WordPress MU. I tried your recommended solution but I was unable to login with my admin account in second blog.

    Actually I am looking for solution where I can can install 2 WP on two different DB and I want to use one DB as a master DB where I can register my all users and my users can access my second blog after the login via first WP wp_users table.

    Still I didn't find any solution but there is a hope.

  6. stvwlf
    Member
    Posted 3 weeks ago #

    Why can't you use WPMU?

  7. kzq
    Member
    Posted 2 weeks ago #

    I don't know what is the problem with WPMU after the installation when I create another admin account then every admin option disappear from screen several time. I tried to transfer data from WP to WPMU but WMPU not taking my previous categories.

  8. stvwlf
    Member
    Posted 2 weeks ago #

    Your site is a natural for WPMU.

    You might want to ask about your difficulties on the WPMU forum http://mu.wordpress.org/forums/

    There are some real experts there.

  9. techjockey
    Member
    Posted 14 hours ago #

Reply

You must log in to post.

About this Topic