Templates 1.2 – proper way to add components to profile home screen?
-
What is the ‘proper’ way to add a component to the user’s home screen? Right now the template 1.2 system loads single/home for the main screen and for the tabbed section home calls members/single/home, which includes hard coded calls to display its groups, invites, friends, blogs & activity templates. I want to add my own template there (events).
Right now I have done this:
bp_core_new_subnav_item( <shortened> 'screen_function'
=> 'events_screen_my_events', <shortend>) );To add My Events (0) to the tabs. In events_screen_my_events I have (just like in groups):
bp_core_load_template( apply_filters
( 'events_template_my_events', 'members/single/home' ) );And, I added an action to ‘bp_after_member_body’ like such:
function events_screen_list_events() {
if ( bp_is_user_events() )
locate_template( array( 'events/single/events' ), true );
}
add_action( 'bp_after_member_body', 'events_screen_list_events' );So, the sysmtem does go to members/single/home, but then my action kicks in and loads the events template at the right time.
In events/single/events I copied the contents of members/single/groups.
Is this the proper way to do these things? It just seems a bit back & forthy…
- The topic ‘Templates 1.2 – proper way to add components to profile home screen?’ is closed to new replies.