• 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 - 1 through 15 (of 42 total)
  • It’d be much less trouble (and hacking) to just setup one multisite install. Multisite uses a global users table by default, and allows you to run all sites off the same WordPress core files (easier upgrades).

    If setting up multisite with subdomains is too complex, you can use a subdirectory structure with the Domain Mapping plugin.

    Leave file “wp-includes/capabilities.php” unmodified,

    choose one “main blog installation” which will hold users data,

    fill in every other blog “wp-config.php” file data of main blog

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

    and as a final step install on all blogs plugin “WP Orphanage” which will care about User Roles

    Plugin URL: https://www.ads-software.com/extend/plugins/wp-orphanage/

    Thread Starter Alex.R

    (@alexr-1)

    meloniq thank you so much, works like a charm.

    Thread Starter Alex.R

    (@alexr-1)

    Hey meloniq, would you possibly know how to fix the cookies issue. When I visit the other sub-domains I’m still prompted to log in. How would I be able to make it so that members are kept logged in even if they visit the other sub-domains? I couldn’t find any plugins related to this.. so I figured I would ask you, or anyone else that might know the solution. Thanks in advance.

    Hi,

    Include in all “wp-config.php” files value (replace value with Your domain name – not subdomain, “dot prefix” is important)

    define('COOKIE_DOMAIN', '.YourDomain.Com');

    And the same keys to all “wp-config.php” files, You can generate it on this site:
    https://api.www.ads-software.com/secret-key/1.1/salt/

    define('AUTH_KEY',         'XYZ');
    define('SECURE_AUTH_KEY',  'XYZ');
    define('LOGGED_IN_KEY',    'XYZ');
    define('NONCE_KEY',        'XYZ');
    define('AUTH_SALT',        'XYZ');
    define('SECURE_AUTH_SALT', 'XYZ');
    define('LOGGED_IN_SALT',   'XYZ');
    define('NONCE_SALT',       'XYZ');

    Clear cookies in web browser for Your website(s) and check hows working now;)

    Thread Starter Alex.R

    (@alexr-1)

    Okay I’ll get on it right now.. one thing though, all wp installations are in subdomains, there is no wp installation on the root, would `define(‘COOKIE_DOMAIN’, ‘.jobortunity.ca’);
    ` still work on all sub-domains?

    Yes, in Your case it should be:

    define('COOKIE_DOMAIN', '.jobortunity.ca');

    Thread Starter Alex.R

    (@alexr-1)

    Okay, I’ve generated new keya, and added same salt keys to all wp-config files, and also added define(‘COOKIE_DOMAIN’, ‘.jobortunity.ca’);

    I decided to test on two sub-domains, activated the stock themes wordpress comes with:

    https://on.jobortunity.ca & https://ab.jobortunity.ca

    Cleared my cookies, via ccleaner for all my browsers. Logged in to Ontario, but when I visit Alberta, I still need to log in. Any suggestions?

    Hey Meloniq,

    First I want to say: nice post !

    I did what you wrote, but I have a question (or 2)

    Is it necessary to use “WP Orphanage”? I use role scope allready…
    On my second site I can only NOT log in anymore: https://stoofvlees.eu/wp-login.php?redirect_to=http%3A%2F%2Fstoofvlees.eu%2Fwp-admin%2Fprofile.php&reauth=1
    Any suggestions?

    Thank you!

    Or somebody else know what I can do?

    Hi Sven01,

    I don’t know this second one plugin, don’t know how it works…
    If You are not a admin on second blog (cant access administrative panel), open phpMyAdmin and change roles to administrator for this user.

    Hi Meloniq,

    You are quick to answer ??
    I am admin for both blogs, and I could login before I changed the settings.
    Now it redirects me to the login page after I tried to login.

    Just redirect? or there is some information whats wrong?
    Try to use other web browser or clear cookies

    I tried ie, googlechrome and opera ??
    on g-chrome it gives me this in my browserwindow: https://stoofvlees.eu/wp-login.php?redirect_to=http%3A%2F%2Fstoofvlees.eu%2Fwp-admin%2Fprofile.php&reauth=1 and a new login screen.
    I just want that my users have 1 login for all my blogs and if possible that they kept login when they change blog.
    I did change :
    define(‘AUTH_KEY’, ‘XYZ’);
    define(‘SECURE_AUTH_KEY’, ‘XYZ’);
    define(‘LOGGED_IN_KEY’, ‘XYZ’);
    define(‘NONCE_KEY’, ‘XYZ’);
    define(‘AUTH_SALT’, ‘XYZ’);
    define(‘SECURE_AUTH_SALT’, ‘XYZ’);
    define(‘LOGGED_IN_SALT’, ‘XYZ’);
    define(‘NONCE_SALT’, ‘XYZ’);

    with the same values ass my primary site, can this be the problem?

    Whats Your second WordPress installation URL?
    Did You add on “slave” installation to wp-config these lines?

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

    If You can’t login perhaps You missed lines above, if You can’t access “wp-admin” perhaps You are “Orphan” (user without roles)

    I did uninstall and re-install, now I can login, but I still have different logins for the blogs ??
    first is 4lol.eu and second stoofvlees.eu , still more blogs waiting, but first these 2 must work good …

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