Support » Fixing WordPress » Using one database for 2 sites

  • I have two separate installs on the same domain (www.mysite.com and http://www.mysite.com/second-install) I was able to successfully connect the 2 sites to single database and when I create a user in one it shows up in the second install. The only problem I’m having is the user roles not transferring over. I have a vendor marketplace plugin on the root site and it assigns a role to the user but this plugin is not on the second install. I don’t necessarily need it to move that user role over as much as I need the user to automatically be assigned a designated role for the second-install. Right now they just get no role. I have tried to select in the dashboard settings the user role I want for each new user but the users are not signing up in the second install just the first.

    I hope that’s enough information for someone to have some idea that I can try?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This is the way to share the users between two WordPress sites. You were on the right track but each site needs its own database tables (in the same database) but needs to share one sites user tables with the other site.

    https://kinsta.com/blog/share-logins-wordpress/

    Thanks @jnashhawkins I thought I was on the right track. That is the page that I followed to do this so I’m not sure why it won’t transfer the roles over. I even tried to create a role in the second install that had the same role id (of course I may not have had it right). Any other thoughts?

    There was something about ‘cookie domain’ to preserve the sessions across the two (multiple) sites. The first or donor site is probably fine but the second and subsequent sites might benefit from adding that to their wp-config. Else a second login would be required on the ‘slaved’ site(s).

    And the roles will be whatever is set in the ‘master’ site even though there isn’t really a master site. For admin purposes, I’d probably consider one or the other the donor or master.

    There are three tables… right? If you miss one that might limit the roles on the other. I think I’m right on that.

    Also, some user plugins will set and operate on certain user roles so you want to have the same user plugins on each site unless you know you don’t need to do that. I’d imagine a plugin that can modify user data according to ‘actions’ other than user admin actions would need to be on both sites.

    You’ll need to experiment some on that. PHPMyAdmin (or adminer) might be your best friend when trying to work with those.

    Be careful of role spelling. contributor isn’t the same as contributer. Right?

    Admin, admin, and administrator are different roles.

    That’s all I can think of.

    So I’ve been using Webkul’s multi vendor marketplace plugin with Woocommerce store plugin. The Multivendor plugin gives a seller role to users once they are approved so I tried installing both of those on the second site (slaved site) but it crashed it, so no go on that one. Not sure what the issue was with that but it may have been something to do with the slaved site being on a Subdirectory of the Master site.

    I also created a user and gave them a non-plugin based role and that didn’t transfer over to the Slaved site. So I must have some disconnect in the meta data tables somewhere. What would be the 3rd table you are thinking of? I am not super savvy on the database side of WP. I’ve got the wp_users and wp_usermeta taken care of in the config file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.