I have a subfolder install of WP multisite, let's say at "domain.com".
I now need to load the WP environment in subdomains of domain.com, say "sub1.domain.com", "sub2.domain.com", ... "subN.domain.com". Note that these subdomains do not correspond to WP blogs. But I do need to have access to the logged in user, the database, etc.
I have set up wildcard subdomains to load a php file that will display what I need for any particular subdomain, and I am including "wp-load.php" early in that file. The problem is that near line 99 in "ms-settings.php" it redirects to the main page of the site because $_SERVER[ 'HTTP_HOST'] is the subdomain, not the main site domain.
So how can I load the WP environment correctly in a non-blog subdomain?
I have a prototype that works, but I'm worried about the side effects of what I'm doing so it would be great if someone who's familiar with the core could weigh in.
What I am doing is pre-populating the $current_site and $current_blog globals appropriately before including "wp-load". Then, "ms-settings" doesn't try to create these and doesn't hit the code path that detects the subdomain and redirects to the front page.
I can now access member information (e.g. using 'get_userdata') and $wpdb.
Does this seem like a reasonable approach?