• Hello everyone,

    I have two sites like SITE1 and SITE2. I have configure both sites using one database and table prefix have different, and user same user table using

    SITE1 prefix have ‘wp_’

    and SITE2 have

    $table_prefix = ‘cd_’;
    define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘wp_usermeta’);

    then site is working properly after some customization.

    but,

    I need when user login to first site then he will logged to second site and when he login to second then auto login to first site

    Then please help me what i do exactly,

    I’m a developer.

    Thanks in advance,
    chandrakant B.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Digico Paris

    (@digico-paris)

    Hi Bachav,

    No problem to run 2 wp sites on same database, according you have different prefixes (you did), but you also need two different ‘admin’ users for each wordpress setup.

    You do that when you use the wp installer (in browser), or editing wp_options table for each one along with wp-config.php files – meaning 2 wp-config.php files with different admin users – one for each folder or site. But I suggest you do the web browser install, one for each site, it’s easier/faster on the process.

    Hope it helps,

    Thread Starter Chandrakant Bachhav

    (@bachhav36)

    Hi Digico,

    Thanks for reply fast.

    I’ve already did this procedure, like to separate setup for admin, both sites are working properly on one ‘wp_users’, ‘wp_usermeta’ table and another are,

    1 SITE have below tables,

    wp_commentmeta
    wp_comments
    wp_links
    wp_options
    wp_postmeta
    wp_posts
    wp_terms
    wp_term_relationships
    wp_term_taxonomy
    wp_usermeta
    wp_users

    2nd site have below tables

    cd_commentmeta
    cd_comments
    cd_links
    cd_options
    cd_postmeta
    cd_posts
    cd_terms
    cd_term_relationships
    cd_term_taxonomy

    and all tables are placed under same database

    I used already

    $table_prefix = ‘cd_’;
    define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘wp_usermeta’);

    then site is working properly after some customization in some files.

    Currently I can use same users in both site.

    SITE1 domain is: https://example.com/

    SITE2 is : https://example.com/subfolder/

    then I need when SITE1 user is login and he goes to SITE2 then he will showing already login.

    Then Please Help me WHAT I DO ?

    I’m facing trouble.

    Thanks in advance,
    chandrakant b.

    Digico Paris

    (@digico-paris)

    Hi again,

    *itch head* Yeah trouble, because if SITE1 admin logs in to SITE2 automatically, which is in theory possible – from same ip WordPress will disconnect it from SITE1 (by cookie at login).

    Another big issue, what happens if you write a post on SITE2 while “in theory” still connected to SITE1? That is way beyond my knowledge of WordPress core, sorry.

    Thread Starter Chandrakant Bachhav

    (@bachhav36)

    Hi,

    Finally I have find solution,

    When login to first site create session then access this session for another site and use script ‘Auto Login’ for other site.

    enjoy ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Login to both sites’ is closed to new replies.