Support » Fixing WordPress » share user cookie between two blogs within same domain.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Dude, #1 – stop bumping. That’s a sure-fire way to get completely ignored. Probably IF anyone knows the answer, they haven’t visited yet. You just posted for the first time yesterday, and not a full day has gone by yet.

    #2 NEVER screw with your wp-cofig.php file, save to put in your database connection settings. Try .htaccess instead.

    And stop bumping – IF someone knows the answer, they’ll come by and answer. If they don’t, they won’t.

    [mod: bumps deleted – next time the whole topic will be deleted!]

    sorry about that, i’ll stop bumping. however may i suggest you go read documents on wp-config file as you obviously have no clue what your talking about. don’t mess with wpconfig mess with htaccess instead

    thx anywayz.

    hopefully i can get this resolved soon.

    have you *tried* messing with the .htaccess? or are you simply discounting me because I told you to stop bumping?

    In fact, no, I don’t know how to do this. I dont’ think .htaccess will work. Personally, I think if you want one login for two blogs, then you need WPMU – not WP. As far as I know, you cannot do this unless you’re running WPMU.

    But whatever.

    htaccess has nothing to do with what i am tryng to do. method above has worked for 2.5 and below i just can’t simply get it working with 2.6.2 and no i am not discounting you because you told me to stop bumping and as far as “you” know its not possible, how ever

    I already have one login for both blogs, if i make an account on the first blog i can use that account to login at the second blog. (same user table).

    now i just need to get the cookie issueing sorted out.

    Right, as far as *I* know. I never said I knew the answer (and if I did, I would have provided it – I’m simply offering suggestions that may or may not work). Cookies are not my thing – I rarely work with them.

    As for using the same user table for more than one blog, that’s actually a pretty cool idea.

    I did a quick google, on it, and found a bunch of stuff. Don’t know which one will work though.

    heres how you do it:P i did all the research for ya, this one works found it from different places on the forum.

    install first blog manually not using fantastico.

    install second blog manually only using same database information change the table prefix to wp_whatever if your first one was wp_(original.)

    now they are using same database but installed seperatly using different table prefix.

    now on second wordpress wp-config put this code in right under db_collate

    define(‘CUSTOM_USER_TABLE’, $table_prefix.’wp_users’);
    define(‘CUSTOM_USER_META_TABLE’, $table_prefix.’wp_usermeta’);
    define(‘CUSTOM_CAPABILITES_PREFIX’, $table_prefix.’wp_’);

    that will tell wordpress to use the same userbase as the first blog.

    now to tell wordpress to automatically copy user permissions
    open up wp-includes/capabilities.php

    find this line $this->cap_key = $wpdb->prefix . ‘capabilities’;

    replace it with

    if (defined (‘CUSTOM_CAPABILITES_PREFIX’)) {
    $this->cap_key = CUSTOM_CAPABILITES_PREFIX . ‘capabilities’;
    else {
    $this->cap_key = $wpdb->prefix . ‘capabilities’;

    and walah now you can log on to both blogs and create account from either one. its all the same.

    now to figure out how to log on to both at the same time.

    sheesh i tryed doing this with 2.5.1 and it didn’t work.

    any suggestions? plugins? changing logins? querying login.php twice? some ideas?

    Give this a shot, yo. I did this in WP 2.7.1.

    Once you have the users sharing a database table as you described above, open your wp-config.php for both blogs.

    Copy the AUTH_KEY and SECURE_AUTH_KEY lines from your main blog’s wp-config.php to your second blog’s wp-config.php so that they are the same in both.

    Create a line in your main blog’s wp-config.php file that looks like this:

    define('SECRET_SALT', 'L3klg#a;&-,Ab;&UT+y');

    You should replace the salt value string above with your own, possibly generated for you using this page. DO NOT simply copy and paste the above line, because that would be wrong-hearted.

    Once you’ve done that, copy the SECRET_SALT line from your main blog’s wp-config.php to your secondary blog’s wp-config.php file so that it is the same in both.

    Create the following lines in both wp-config.php files:

    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIEPATH', '/');
    define('SITECOOKIEPATH', '/');
    define('COOKIEHASH', md5('Another random string value!'));

    Important Notes:

    1. COOKIEHASH is normally defined in your wp-settings.php file on line 351. Unlike most of the other constants here, it doesn’t check if it’s already defined before defining it. On my server, this doesn’t cause any problems, but if you notice error messages like ‘COOKIEHASH is already defined’ or something, that’s probably the problem. If you want to hack up core files (which we’ve already done by now), you can comment out that line in wp-settings.php and that should take care of it.
    2. Remember to replace the COOKIEHASH value above with your own string.

    Save both wp-config.php files, clear your browser’s cookies and log in to either blog. Once your in the admin area, try hitting the admin area of the other blog and it should work fine.

    Hi macbis,

    I followed your instructions, but when I try going to the second admin area, I get a “Please log in again” message.

    Are you also supposed to copy the LOGGED_IN_KEY and NONCE_KEY so both are identical on each blog?

    Also is there a specific order that these define codes need to be placed?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘share user cookie between two blogs within same domain.’ is closed to new replies.