Re: Templates 1.2 – proper way to add components to profile home screen?
hi Erwin
A better way will be following the bp 1.2 style.
So, you provide different filters for loading template, but all of them loads the same Index/home by default, which acts as a multiplexer using conditions as done in bp 1.2 theme.
If you/a user really need to change this scheme, the filters can always be used to change template file.
for example,
//for loading user gallery Home page, I will do something like this in the screen function
bp_core_load_template( apply_filters( 'gallery_template_my_galleries', 'gallery/index' ) );
and for loading single gallery page I do something like this in the screen function
bp_core_load_template( apply_filters( 'gallery_single_gallery', 'gallery/index' ) );
So, both of these will load index which in turn loads further based on condition, but if a user do not wish to use hard coding in the theme with conditional, he can use the filters to manipulate this like
add_filter("gallery_single_gallery","my_single_gallery_template");
function my_single_gallery_template($template){
return "gallery/single/index";
}
The reason I followed bp 1.2 style, It saves some typing and allows to reuse the layout+ I am trying to stick with the official style