-1

I'm trying to use a multisite install to keep a single php and database source but I need to use woocommerce separated in the websites, allowing the sites to have they clients separated at same time that maintain the admins in same network.

The only workarround that I found is to maintain a separated users table for each site and keep the admins in core users table than load in cache, creating a "global_users" and "local_users".

Anybody know some other way to do this or a way to improve this (maybe don't using the cache this way)?

1
  • Another solution that I'm think is instead of create a new user tabel to all sites, create just one table replacing the core users table with a "blog_id" field, then replace the login and create account functions (or filter) checking for users with the current blog id Mar 17, 2020 at 17:54

1 Answer 1

0

I don't know if is the best way to do this but aparently works well.

I override the users table adding one with an blog_id field as key. Add an "wp_pre_insert_user_data" filter to set the blog_id field and change the user id to some like "blog_id000user_id" (100044 for example is from blog 1).

Override the core "get_user_by" function to another, calling a custom "get_data_by" functions instead of the wordpress user method. This new function search the user table by blog_id and allow the admins and the site clients to connect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.