Template Updates 2.2

Theme template changes & updates for BP 2.2.0 Theme template changes & updates for BP 2.2.0

Group create & blog create buttons Group create & blog create buttons

Historically the two buttons to add a new group or blog that displayed on the respective directory pages were rendered within the heading tag for those pages, with the arrival of theme compatibility in 1.7 this practice was continued to preserve backwards compatibility however now we needed to add the link or button into the WP the_title() function

This was never an ideal situation so in the 2.0.0 release we changed things around slightly ( On ticket #5144 ) so that the buttons were filtered in, this meant that we now had to take deliberate action elsewhere to have this happen with the default behavior being not to push the button through to the title function, in buddypress-functions.php we added two new add_filters and supporting functions to ensure that the established behavior continued and end users would have not seen any change but now we could easily remove the filters and simply add the bp_’group/blog’_create_button() via an add action where we required it.

Moving forward to BP 2.2.0 and the decision was taken to finally remove this behavior and stop injecting the create buttons in the title tag, prompted by this ticket #6008.

The tricky part was once removed where were the buttons to be moved to? There were few options available and although a fair bit of debate the consensus was to put them in the item-list-tabs ul list where the filters are. If themes are found to be still filtering the button to ‘bp_groups_directory_header’ this will be trapped and redirected to render in the item-list-tabs

Naturally not everyone might want the links in the header so to that end it is possible to prevent the create buttons rendering in the list tabs by using:
add_filter( ‘bp_get_group_create_nav_item’, ‘__return_false’ );

add_filter( ‘bp_get_blog_create_nav_item’, ‘__return_false’ );

Having removed this new positioning you can add your buttons back by using one of the available ‘do_action’ function calls in the templates, for example:

add_action( ‘bp_before_directory_groups’, ‘bp_group_create_button’ );
add_action( ‘bp_before_directory_blogs_content’, ‘bp_blog_create_button’ );