• Resolved haxxxton

    (@haxxxton)


    Heya,

    So im pretty sure what im trying to do is possible but ive never used multi site.. or even if i need to use it for what i’m trying to do.

    The idea is that id have two installs (so that they can use different themes) and have different categories, posts etc. one would be on the root domain, the second would be in a folder of the root.. eg:

    site1: https://mysite.com/
    site2: https://mysite.com/blog

    Now i have got them set up on a single database using different table prefixes.. (one is on ‘pm_’ the other is on ‘memb_’)

    now i have updated the wp_config files of both installs to contain the following

    define('COOKIE_DOMAIN', false);
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIEPATH', false);
    define('SITECOOKIEPATH', false);
    define('COOKIEHASH', 'hidden');
    define('AUTH_KEY',         'hidden');
    define('SECURE_AUTH_KEY',  'hidden');
    define('LOGGED_IN_KEY',    'hidden');
    define('NONCE_KEY',        'hidden');
    define('AUTH_SALT',        'hidden');
    define('SECURE_AUTH_SALT', 'hidden');
    define('LOGGED_IN_SALT',   'hidden');
    define('NONCE_SALT',       'hidden');
    define('TEST_COOKIE', 'TEST_COOKIE'.COOKIEHASH);

    the problem is, i can log in to each individually however, when i do.. it logs me out of the other..

    what am i missing? is this possible?

    any help very much appreciated please

Viewing 1 replies (of 1 total)
  • Thread Starter haxxxton

    (@haxxxton)

    argh.. ok so i think i have solved it..

    i needed to do 2 extra things..

    in the non-main site.. ie the one at https://mysite.com/blog i needed to add the following to the wp-config.php file

    define('CUSTOM_USER_TABLE', 'pm_users');
    define('CUSTOM_USER_META_TABLE', 'pm_usermeta');

    obviously replace pm_ with the prefix of the database for the main section

    i had to update the _init_caps function in the capabilities.php file in wp-includes of the non-main site

    .. now before the code below i would STRONGLY advise AGAINST changing core files..

    function _init_caps( $cap_key = '' ) {
        global $wpdb;
    
        /* if ( empty($cap_key) )
            $this->cap_key = $wpdb->prefix . 'capabilities';
        else
            $this->cap_key = $cap_key; */ /*original */
        $this->cap_key = 'pm_capabilities'; /*modified code */
    
        $this->caps = get_user_meta( $this->ID, $this->cap_key, true );
    
        if ( ! is_array( $this->caps ) )
            $this->caps = array();
    
        $this->get_role_caps();
    }
Viewing 1 replies (of 1 total)
  • The topic ‘one login, two installs, one database, one domain’ is closed to new replies.