When developing a large application in WordPress one option is to implement it as a theme rather than a series of plugins. When the project has multiple developers, a challenge then is how to provide each developer their own environment. If the site is standalone then each developer can have their own local WP instance. But what about the database? If different developers are adding records to different databases how are they merged.
Anyway, in my scenario there's a simpler approach. Let each developer have their own copy of the theme within the themes folder. The only requirement then is to be able to allow each user to choose or to be allocated a specific theme. This is really easy to do.
The main function is the one that reacts to the 'wp_loaded' action. The action function looks to see what theme template folder is defined in user meta for the user and returns it. Otherwise it returns a default theme folder.
The rest of the code adds a dropdown of the available themes to the user profile page