You’d need to change the overload file to be one from the legacy template.
So it’s not possible, I should notify my clients to work only with [nouveau] template .. Right?
That would probably be best, otherwise you’d have to write your own progrmatic way of switching between the two template files depending on the theme used.
That’s my question bro, I cannot find the way to do that because the folders in the two templates are same.
if there’s a function to define the folder to read files from according to the user option
Ex. get_option(‘_bp_theme_package_id’) -> [/THEME/temp1/buddypress] or [/THEME/temp2/buddypress]…
Thanks Pal
You’d have to do something like this:
function venutius_start() {
if( function_exists( 'bp_register_template_stack' ) ) {
bp_register_template_stack( 'venutius_register_template_location' );
}
// if viewing a member page, overload the template
if ( bp_is_user() ) {
if ( bp_get_theme_package_id() == 'legacy' ) {
add_filter( 'bp_get_template_part', 'venutius_replace_template_legacy', 10, 3 );
}
if ( bp_get_theme_package_id() == 'nouveau' ) {
add_filter( 'bp_get_template_part', 'venutius_replace_template_nouveau', 10, 3 );
}
}
}
add_action( 'bp_init', 'venutius_start' );
function venutius_register_template_location() {
return <directory>; //replace with the main directory you are putting your new template files in
}
function venutius_replace_template_nouveau( $templates, $slug, $name ) {
switch($slug) {
case 'members/single/profile/change-avatar' :
if ( '<your_directory>/members/single/profile/change-avatar.php' ) ) {
return array( 'members/single/profile/change-avatar.php' );
break;
} else {
return $templates;
break;
}
}
return $templates;
}
function venutius_replace_template_legacy( $templates, $slug, $name ) {
switch($slug) {
case 'members/single/profile/change-avatar' :
if ( file_exists( '<your directory>/'members/single/profile/change-avatar.php' ) ) {
return array( 'members/single/profile/change-avatar.php' );
break;
} else {
return $templates;
break;
}
}
return $templates;
}
Something like that should work, not tested it though but you should get the idea.