Hi there.
This is a bit of a strugle for me. I've been diving into Wordpress multisite code for a while now and I've got the whole thing running by adding database entries manually (trough sql queries).
I got a multiple domain, multiple subpage setup. I got a wordpress network up and running. I got http://example1.com and http://example2.com pointing to the same storage on my web server. I started up http://example1.com first, adding a subdomain setup. Then I went into the SQL-server and checked the mu_site (mu is my prefix) table. One entry here so I added another one.
INSERT INTO mu_site (id,domain,path) VALUES (2,'example2.com','/')
Now the table shows two lines.
The next part of the hack is the mu_sitemeta table. On a fresh install there are a bare minimum of information here. So I duplicated the whole thing.
INSERT INTO mu_sitemeta (site_id,meta_key,meta_value) SELECT 2,meta_key,meta_value FROM mu_sitemeta where site_id = 1
Now to make things easy, I went into example1.com and added a fresh subdomain trough GUI. Then I entered mu_blogs and found two lines of data. One for example1.com and one for sub.example1.com. I replaced the two fields site_id and domain. blog_id being the primary key in the table and a nice reference I did as following.
UPDATE mu_blogs set site_id = 2, domain = 'example2.com' WHERE blog_id = 2
Wolah.. both example1.com and example2.com got its full webpage trough one setup. It really works flawless, but I would like to add some functionality to the network admin.
- Hitting the admin toolbar "my sites" shows a list of all sites and blogs (no filtering). This is OK.
- Since there is two site_id's one get two network-admin pages. This can be a bit disturbing. They are choosen by first entering example1.com and then the network admin sub menu. If you then hit example2.com and goto the same menu, you will get a different admin. Logical enough, but as I said, a bit messy.
- If you go to the page /wp-admin/network/sites.php the whole query is site_id dependent. And there is where my hack come in handy. A file called /wp-admin/includes/class-wp-ms-sites-list-table.php contain a class extention and here is where the query defines/filters out other site_id's. So I added a little hack here on line 50 and 66. Commenting out the site_id parts. I would love to have this done by a parameter in the future. Any ideas here is most welcome.
- I've added some extra fields with the filter wpmu_blogs_columns and the action manage_sites_custom_column. Now with the help of the site_id and a minimum command I'm able to pick out the main blog_id for each site. This helps me list the total amount of blogs and sites in my big multisite, multiblog network. Hope it helps somebody :)