• Hello everyone,

    I need some guidance in linking user privileges for 13 blogs located in all these sub-domains.

    ——————–
    ab.jobortunity.ca
    bc.jobortunity.ca
    mb.jobortunity.ca
    nb.jobortunity.ca
    nl.jobortunity.ca
    ns.jobortunity.ca
    nt.jobortunity.ca
    nu.jobortunity.ca
    on.jobortunity.ca
    pe.jobortunity.ca
    qc.jobortunity.ca
    sk.jobortunity.ca
    yt.jobortunity.ca
    ——————–

    What has been done so thus far?

    1. I have installed WordPress 3.2.1 to allsub-domains, with individual prefix for every single one on of them into one database.

    2. I wanted all users to share one _users table and one _usermeta table, to have universal login and registration privileges across all these sub-domains.

    So, I saved and modified my first blogs _users, _usermeta tables from the database to my computer in a sql format. I then renamed the tables as universal_users and universal_usermeta, the same was done inside these user tables. Saved and uploaded back onto the same database.

    3. After all that was done, the following took place, I have added the following code to all the wp-config.php files.

    define('CUSTOM_USER_TABLE', 'universal_users');
    define('CUSTOM_USER_META_TABLE', 'universal_usermeta');

    Went back to the website, and performed a test. I encountered the error: ‘You do not have sufficient permissions to access this page.‘.

    So, I went back to the wp-config.php file, and changed the code to use the original _usermeta of each blog, but left the universal_ prefix for users. Went back to test, and it worked. I could use one admin username accross all 13 blogs, so I desided to add a new user named “testuser” and see If I can post on all blogs, and for sure it worked like a charm.

    4. I noticed one problem, when inside dashboard as “testuser” the extra details for the profile did now follow, such as firs name, last name, etc. Because the _usermeta was not universal.

    So then I went back on Google to do more research, since now I need one _usermeta file across all the blogs, but without the error for the login. So I went back to research on Google, and came accross this page: https://www.ads-software.com/support/topic/how-to-use-2-blogs-with-the-same-users?replies=17

    5. After reading the whole article, I resided this is what needs to be done, and to give it a try.. Uploaded the wp-settings.php file onto my machine, and looked for:

    $wpdb->users = $wpdb->prefix . 'users';

    and

    $wpdb->usermeta = $wpdb->prefix . 'usermeta';

    but they are no where to be found.. so what now? I’m confused, did these change in the 3.2.1 version?

    I checked the capabilities.php file, and the code I need to change is there:

    $this->cap_key = $wpdb->prefix . 'capabilities';

    Any help would be greatly appreciated. Or if this has been covered before for the new version of wp, and could possibly point me in the right direction. Thank you in advance, and sorry for the long read.

Viewing 15 replies - 16 through 30 (of 42 total)
  • Whole informations to make this integration are in posts above…
    I dont know how to explain it more clearly…

    If You still have got problems to setup it correctly, make a custom order via email: https://blog.meloniq.net/kontakt/

    Thread Starter Alex.R

    (@alexr-1)

    Meloniq do you have an alternative in regards to my issue with cookies? Thanks.

    I can check and test it in a next few days… but now, I need to hurry a lil, deadline of one project is really close:/

    Thread Starter Alex.R

    (@alexr-1)

    No problem brother, thanks in advance.

    meloniq

    (@meloniq)

    Sorry for long awaiting for answer (forgot about this topic)…

    I tested above solution on one of my websites and it works fine except one thing, transfer login between WordPress installs… correct settings should be:

    1. Install WordPress with the same “secret key”, in one database but with different prefix -> https://api.www.ads-software.com/secret-key/1.1/

    2. For all WP installs activate plugin WP Orphanage
    https://www.ads-software.com/extend/plugins/wp-orphanage/

    3. For “slave” WP installs add to wp-config.php data of main blog user tables

    define(‘CUSTOM_USER_TABLE’, ‘MainBlogPrefix_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘MainBlogPrefix_usermeta’);

    4. After this one step You can’t access wp-admin, right? so add 2 new meta for admin user via phpMyAdmin (or any other equal panel) – add it to “MainBlogPrefix_usermeta”

    user_id => 1
    meta_key => SlaveBlogPrefix_user_level
    meta_value => 10

    user_id => 1
    meta_key => SlaveBlogPrefix_capabilities
    meta_value => a:1:{s:13:”administrator”;s:1:”1″;}

    5. Now You can access admin panel, but still login is not transfered between WP installs, so…
    Open all Your wp-config.php files and paste the same values (off course change domain to Yours before paste)

    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);

    6. Delete all cookies for Your domain and test how login works right now;)

    P.S. Hope that didn’t missed any step, and this tips will be usefull for You;)

    lindaloustarr

    (@lindaloustarr)

    Thank you so very, very much Meloniq I hope your showcase was awesome – as a WP newbie I don’t quite understand the following step 1:

    1. Install WordPress with the same “secret key”, in one database but with different prefix – I show the following (below) in my main (root) wp install wp-config file: (which one of these would be the same “secret key” & do you mean that same secret key would be put into all (in my case 3 separate wp installs) wp-config files?, but what do you mean by “but with different prefix” – I thought these same following keys were to be placed in “all” wp-config” files that are in subfolders that will be sharing the same database for users?

    define(‘AUTH_KEY’, ‘;44&x^=0sb)^iB^aX3QHi|B)vlU&{H!1E)+ox]gU-95.ot:JI-Dz&8o{_]#M`U}I’);
    define(‘SECURE_AUTH_KEY’, ‘YiCcwv;>[+u5tZjJ,1 ;3v.Ee/QA1jvKtxUS0A+`F+a)2[|._TC5S)wjc$O *@T*’);
    define(‘LOGGED_IN_KEY’, ‘9$RGp_cEA-.#QHFg_QkuM 2*1JTFG$$*OB#/r}my]#%erLLb?5s]LEbN`.N,(nC6’);
    define(‘NONCE_KEY’, ‘D`ORTu?46S{l-+x&/p@A7(@y <EO>]K~E,2<y0Vz5WOWXMMcFCpgz(g5_y6Gg&n}’);
    define(‘AUTH_SALT’, ‘_Rt1Z|Yow20Qjo/s!apsmaxxA%W~z6-`YQg*K-DHU:T$-eKm/b(|@N6SXlpe+gqc’);
    define(‘SECURE_AUTH_SALT’, ‘&$m-xjmMfljajrt>(KzKqvq$GoqMedh>dp{#.Mq^e-d&b$:OQ+FOH_@_aBphjk[G’);
    define(‘LOGGED_IN_SALT’, ‘]x*1s7cDUW+Bz#7Ag{1VK#ld#[email protected]&}IY r’);
    define(‘NONCE_SALT’, ‘mH%<mcG-awU4!.VO|B/0x5fK}Br4Xl~nA^f-[aZsGSh(}IAse,TU8r4hB|NA) +W’);

    Thank you so very much for your time in helping with this issue; please forgive my WP innocence at this point – I just want to be sure I understand exactly what to do here since I’ve already done quite a bit of work on the main wp install and I am a bit afraid I might mess something up & undo everything I’ve done already . . .

    Thread Starter Alex.R

    (@alexr-1)

    No worries meloniq, I’ve been working a lot myself, so I didn’t miss much. I have a problem with WP-Orphanage, it collects all the orphans throughout my wp network and gives them all one user role, unfortunately I can’t have that.

    When members register on a particular province sub-domain they are automatically assigned a user role based on their selection on the registration page as a Job Seeker, or Employer.

    Link: https://on.jobortunity.ca/wp-login.php

    I’ve followed the instructions to the tea, cleaned cookies on all browsers, and tested still no luck. Would there be a more custom way to do this? Perhaps something that would work for 2 user roles?

    ======

    lindaloustarr you should not display your secret key on the forums.. what meloniq meant was when you have 2 different blogs, each wp-config should have same secret key.. Go to: https://api.www.ads-software.com/secret-key/1.1/ – what ever key is generated, copy and replace your current secret key in blog 1, and add the very same key to blog 2..

    BLOG 1 – NEW SECRET KEY
    BLOG 2 – SAME NEW SECRET KEY AS BLOG 1

    —————————– THIS IS YOUR CURRENT SECRET KEY—–

    define(‘AUTH_KEY’, ‘;44&x^=0sb)^iB^aX3QHi|B)vlU&{H!1E)+ox]gU-95.ot:JI-Dz&8o{_]#M`U}I’);
    define(‘SECURE_AUTH_KEY’, ‘YiCcwv;>[+u5tZjJ,1 ;3v.Ee/QA1jvKtxUS0A+`F+a)2[|._TC5S)wjc$O *@T*’);
    define(‘LOGGED_IN_KEY’, ‘9$RGp_cEA-.#QHFg_QkuM 2*1JTFG$$*OB#/r}my]#%erLLb?5s]LEbN`.N,(nC6’);
    define(‘NONCE_KEY’, ‘D`ORTu?46S{l-+x&/p@A7(@y <EO>]K~E,2<y0Vz5WOWXMMcFCpgz(g5_y6Gg&n}’);
    define(‘AUTH_SALT’, ‘_Rt1Z|Yow20Qjo/s!apsmaxxA%W~z6-`YQg*K-DHU:T$-eKm/b(|@N6SXlpe+gqc’);
    define(‘SECURE_AUTH_SALT’, ‘&$m-xjmMfljajrt>(KzKqvq$GoqMedh>dp{#.Mq^e-d&b$:OQ+FOH_@_aBphjk[G’);
    define(‘LOGGED_IN_SALT’, ‘]x*1s7cDUW+Bz#7Ag{1VK#ld#[email protected]&}IY r’);
    define(‘NONCE_SALT’, ‘mH%<mcG-awU4!.VO|B/0x5fK}Br4Xl~nA^f-[aZsGSh(}IAse,TU8r4hB|NA) +W’);

    ———————————————-

    You should never share your secret key with anyone online. Extreme Security Risk!

    As for different prefix, when you install your WordPress Blog, you will see something like wp_ and the option to change this. It’s good practice to change them, making it harder for hackers to figure them out ?? for example instead of wp_ change it to a number prefix 911_ or 12345_ etc. My prefixes contain numbers and letters, I suggest you do the same. For a website like mine, I have 13 blogs running, and I made a note as to which province each prefix belongs to.. Taking notes in everything is key. If you have Word or Excel, both are great to keep track of everything you do on your website. Notes are key..

    lindaloustarr

    (@lindaloustarr)

    Thank you ?? & Thank you for the information I needed to understand about in my question. I certainly wouldn’t do this again (reveal the keys) & will change now!
    Linda Lou

    meloniq

    (@meloniq)

    RE: lindaloustarr
    Explain of step number 1:
    a. Create one new database for all of WP installs, lets say “MyNewDB”,
    b. In wp-config.php file of main and slave blogs set the same values which You will generate on below site:
    https://api.www.ads-software.com/secret-key/1.1/

    define(‘AUTH_KEY’, ‘XYZ’);
    define(‘SECURE_AUTH_KEY’, ‘XYZ’);
    define(‘LOGGED_IN_KEY’, ‘XYZ’);
    define(‘NONCE_KEY’, ‘XYZ’);

    c. Then install first main WP blog with table prefix “wp_” (as WP default prefix for tables)
    d. Second blog You already can’t install with the same table prefix so lets change it for example to “blog2_”, third WP with “blog3_” etc…

    RE: Alex.R
    In Your case that You need more then one user role, You should to skip step with WP-Orphanage, and make a “hardcoding” inside of file “wp-includes/capabilities.php”, means edit prefix for “capabilities” meta and perhaps for “user_level”
    Piece of informations: https://www.ads-software.com/support/topic/wordpress-25-share-users-table

    lindaloustarr

    (@lindaloustarr)

    Thank you Meloniq ?? – one last question before I brave this new territory . . . if I make a brand new database for my current root wp install (that will be the same database used for the 2nd & 3rd in sub-directories; if I understand you correctly) won’t I lose all my current changes that I have already made on my main wp install? (I don’t have any users at this point but I have made a huge amount of customizations to it). Also, I understand that I’m using the same database for all installs so it would stand to reason that I am also using the same username & password on all wp-config files?

    Wishing you many blessings. You are gratefully appreciated ??
    Linda Lou

    meloniq

    (@meloniq)

    Yes, one database for all wordpress installs (if You have already installed “root blog” use his database to install second and third wordpress, if not – create new one).

    You will not loose anything what You already made on Your “root blog”, for this You have to set different “prefix” for every wp install (but make a backup of DB, just for a case that something goes wrong).

    Yes, You should use the same username and password for Your database as in “root blog”.

    Thread Starter Alex.R

    (@alexr-1)

    RE: Alex.R
    In Your case that You need more then one user role, You should to skip step with WP-Orphanage, and make a “hardcoding” inside of file “wp-includes/capabilities.php”, means edit prefix for “capabilities” meta and perhaps for “user_level”
    Piece of informations: https://www.ads-software.com/support/topic/wordpress-25-share-users-table

    Thanks meloniq, I’ll give it a read and try that method tonight, I just got back home from work, need to unwind first.. lol I’ll let you know what the result is. =)

    P.S. How’s the weather in Poland?.. I’m in Canada, and it’s getting bloody cold out..

    meloniq

    (@meloniq)

    Users which gonna use sub-directories instead of sub-domains should add 2 additional parametres into wp-config.php:

    define('ADMIN_COOKIE_PATH', '/');
    define('SITECOOKIEPATH', '/');

    @meloniq I have a small confusion in the last step

    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);

    I have defined my security keys by editing default config files. Now do I need to replce the value in above code also or should I just copy paste as it is. I mean do I change the code after the line

    $baseurl = ‘https://www.YourMainDomain.com&#8217;;

    or it is to be pasted like this only after replacing the domain name?

    RE: Keshav
    Copy as is, just change domain to your.

    RE: Alex.R
    If you still looking for solution with transfering user roles from other WP installations (JobRoller use 3 custom roles) – test extended version of WP-Orphanage plugin ( https://www.ads-software.com/extend/plugins/wp-orphanage-extended/ ), I published it just today;)

Viewing 15 replies - 16 through 30 (of 42 total)
  • The topic ‘Universal Login for 13 Blogs’ is closed to new replies.