Set template by custom code


As far as I've read the topics for this plugin, I see many requests on having the ability to automatically assign a template in accordance with a given context and/or configuration (integration with Membership for example). A very simple way to achieve this in any situation is to add this line of code on line 189 of 'blog_templates.php':

$template = apply_filters( 'blog_template_index', $template, $this );

To make this code completely work, line 185 must still be deleted (useless due to line 191).

This way, we have everything we need to extend the plugin and create custom code accordingly.

Actually, I need this: I must assign the right template according to the language chosen by the new user. There's still the ugly way:

function custom_blog_template() {
	global $blog_templates;
	if ( is_a( $blog_templates, 'blog_templates' ) ) {
		$_POST[ 'blog_template' ] = apply_filters( 'blog_template_index', $_POST[ 'blog_template' ], $blog_templates );
add_action( 'wpmu_new_blog', 'custom_blog_template' );

But please, I'd really like to avoid this kind of patch.