Modify/Override Buddypress Function
-
Hello, I am attempting to override the following function:
/** * Locate a custom group front template if it exists. * * @since 2.4.0 * * @param BP_Groups_Group|null $group Optional. Falls back to current group if not passed. * @return string|bool Path to front template on success; boolean false on failure. */ function bp_groups_get_front_template( $group = null ) { if ( ! is_a( $group, 'BP_Groups_Group' ) ) { $group = groups_get_current_group(); } if ( ! isset( $group->id ) ) { return false; } if ( isset( $group->front_template ) ) { return $group->front_template; } $template_names = apply_filters( 'bp_groups_get_front_template', array( 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 'groups/single/front.php' ) ); return bp_locate_template( $template_names, false, true ); }
My new function replaces
'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php',
with
'groups/single/front-slug-' . sanitize_file_name( current(explode("/", $group->slug)) ) . '.php',
but that is not the important part. My real question is how can I override/replace this function in my theme’s functions.php file. (Want to keep things upgrade-proof!)
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Modify/Override Buddypress Function’ is closed to new replies.