• hello,
    i am new here,
    trying to use domain and subdomain with the same login admin, got some problems with cookies(i think).

    I did some reseach, and tried 2 ways :
    1- https://www.ads-software.com/support/topic/universal-login-for-13-blogs?replies=42
    2- https://nokeywordinurl.com/2-wordpress-blogs-with-1-users-table-and-1-login/

    but have still a problem, when i login with maindomain admin, and go to sub-domain, i can’t be a manager, but only as Subscriber.

    I added in sub-domain wp-config after ($table_prefix = subdomainprefix)

    define('CUSTOM_USER_TABLE', 'MainBlogPrefix_users');
    define('CUSTOM_USER_META_TABLE', 'MainBlogPrefix_usermeta');

    Then via phpMyAdmin add into “MainBlogPrefix_usermeta” :

    user_id => 1
    meta_key => SlaveBlogPrefix_user_level
    meta_value => 10
    
    user_id => 1
    meta_key => SlaveBlogPrefix_cap<em>abilities
    meta_value => a:1:{s:13:"administrator";s:</em>1:"1";}

    I added in maindomain wp-config.php and sub-domain wp-config :

    define('COOKIE_DOMAIN', '.YourMainDomain.com');
    define('COOKIEPATH', '/');
    
    $baseurl = 'https://www.YourMainDomain.com';
    $cookiehash = md5($baseurl);
    define('COOKIEHASH', $cookiehash);
    define('AUTH_SALT', 'AUTH_SALT'.COOKIEHASH);
    define('LOGGED_IN_SALT', 'LOGGED_IN_SALT'.COOKIEHASH);
    define('AUTH_COOKIE', 'AUTH_COOKIE'.COOKIEHASH);
    define('SECURE_AUTH_COOKIE', 'SECURE_AUTH_COOKIE'.COOKIEHASH);
    define('LOGGED_IN_COOKIE', 'LOGGED_IN_COOKIE'.COOKIEHASH);
    define('TEST_COOKIE', 'TEST_COOKIE'.COOKIEHASH);

    Then i delete cookies via ccleaner, but no way…!!!
    still can’t be a manager on my subdomain!!

    ps. i tried : WP Orphanage ,WP Orphanage Extended, root Cookie
    another info : in my maindomain i work with wp 3.3.2 , my sub-domain i use 3.3.1 .

    please helpppppp!!!
    thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    trying to use domain and subdomain with the same login admin

    So. You’re using Multisite, why not map the second domain?

    Thread Starter Fazio

    (@fazio)

    Please some details ??

    thank you.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    To .. which part?

    Assuming you’re using Multisite (Since you posted here), you just need this https://www.ads-software.com/extend/plugins/wordpress-mu-domain-mapping/ to map a domain.

    Thread Starter Fazio

    (@fazio)

    in fact i would prefere a solution in line with what i was already doing. Unless i will try the maping method.

    Does anybody have a solution for cookies?

    Thank you.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You have two options here.

    1) You ARE using Multisite, so just use the plugin (which is the preferred method and what the pros use)

    1b) You’re using Multisite but want to reinvent the wheel.

    2) You’re NOT using Multisite, so you’re in the wrong subforum ??

    Which is it?

    Thread Starter Fazio

    (@fazio)

    Yes i am using the multisite, to manage all subdomains.
    If i use that plugin, i may manage my subdomains as manager, with the same pass and admin id, of my maindomain wp access? also if they are different?

    The existing users will be able to pass from a sub-domain to another or maindomain without login again?

    Thank you.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    If i use that plugin, i may manage my subdomains as manager, with the same pass and admin id, of my maindomain wp access?

    Yes. ALL that plugin does is MAP a domain. It makes subdomain.foobar.com work as newfoobar.com ?? It’s magic ??

    The existing users will be able to pass from a sub-domain to another or maindomain without login again?

    No, but that’s not anything you can ‘fix’ due to cross-domain scripting (tl;dr, you can’t use the same cookie on multiple domains. It’s for security, so nefarious people can’t screw you over.)

    Thread Starter Fazio

    (@fazio)

    New users may do such a thing? passing from a sub-domain, maindomain without login again?
    unless it is a huge limite!!!!

    thank you for the help.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I’m sorry, I don’t understand what you’re asking….

    New users may do such a thing? passing from a sub-domain, maindomain without login again?

    Do you, perhaps, mean “No users may do such a thing?” And is so, that is correct. It’s a technical limitation of all websites, however, not anything Multisite related (or even WP). You don’t WANT cross-domain cookies either. Trust me, it’s a huge security risk.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘2 blogs with same login and db – problem with cookies.’ is closed to new replies.