I would like to make a simple API for MU-Wordpress for my own use but I'm not having much luck. I've made some plugins and have been quite pleased with how easy and intuitive it has been to figure out Wordpress, however if I use that same exact code in a non-plugin it refuses to work.
I've noticed that in order for my API to run and not get re-directed to the registration page I need to add the following:
define("WP_INSTALLING", true);
However, when I add that code lots of MU functions that I need stop working. Things like switch_to_blog() and add_user_to_blog(), and lots of other functions I need. There are no errors, they simply do nothing when called. I've been getting around this by tracing the functions and copying the exact SQL queries I need, but why re-invent the wheel? Surely someone has tried this before, so isn't there a simple way I can make an API for MU-WordPress? Could someone point me to an example?