WordPress.org

Ready to get started?Download WordPress

Forums

Two blogs working from one user database (5 posts)

  1. Arash
    Member
    Posted 4 years ago #

    I have a current blog with a few thousand users and am going to launch a totally new blog, with a different domain name, but working from the same server.

    I would like to work from one user database base, but have different databases for content, plugins and so on.

    Searching the forum I have found multiple similar questions and asnwers, with possible solutions such as:

    - WordPress MU
    - WP Hive
    - Redcoding wordpress

    Yet I cannot find one working example of the answers.

    Do you have a successful experience with having 2 blogs, 2 different themes and plugins, but 1 user database?

  2. stvwlf
    Member
    Posted 4 years ago #

    A way to do this that works is:

    You use the same database for both blogs. The 2nd blog uses a different tablename prefix than the first one. The setting for prefix is in each blog's wp-config.php file.

    Both are separate WordPress installations, using their own WordPress software installations and their own themes.

    There is no connection between the two sites other than their separate database tables are in the same database.

    The reason for doing it this way is you add code to the wp-config.php files telling the installations to use the users table from the first site on the second site.

    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, you 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. akanowicz
    Member
    Posted 4 years ago #

    Is it possible to have two WP installs (on the same server acct) share the same Database (not just tables)?

    The reason I'm asking is because I'm revamping my site's theme, and while I'm developing the new one it would be great (or would it?) to share the db, so that I can see what it will look like with my real content. Or are there other tools/methods for doing this?

    thanks,
    Ron

  4. LSmith
    Member
    Posted 4 years ago #

    I appreciate your taking the time stvwlf to post this, but when I add this code to my wp-config I get "Cheatin’ uh?" and am not able to access wp-admin/ in the newly-deployed WordPress site.

  5. MichaelH
    Member
    Posted 4 years ago #

    See LSmith's new topic at http://wordpress.org/support/topic/352607

Topic Closed

This topic has been closed to new replies.

About this Topic