Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customize bp-group-template.php

  • @taraclaeys

    Participant

    I would like to edit a sentence in the bp-group-template.php file (the $message on line 1884). How can I create a hook or in some way edit this so as not to edit bp core file? I have seen suggestions about the .pot file, but I believe that gets overwritten on an update? I would prefer something I can put in my theme file.
    I am using a custom Genesis Child theme on the site. I am using WordPress 4.4.1 and BuddyPress 2.4.3. My group is protected so cannot share the url, but you can see a screenshot here:
    https://www.dropbox.com/s/e5ln7j5nj8s1wjy/Screenshot%202016-01-26%2020.46.59.png?dl=0

    Thank you!

    function bp_get_groups_pagination_count() {
    global $groups_template;

    $start_num = intval( ( $groups_template->pag_page – 1 ) * $groups_template->pag_num ) + 1;
    $from_num = bp_core_number_format( $start_num );
    $to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num – 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num – 1 ) );
    $total = bp_core_number_format( $groups_template->total_group_count );

    if ( 1 == $groups_template->total_group_count ) {
    $message = __( ‘Click the name of the group below to view your Challenge Group.’, ‘buddypress’ );
    } else {
    $message = sprintf( _n( ‘Viewing %1$s – %2$s of %3$s group’, ‘Viewing %1$s – %2$s of %3$s groups’, $groups_template->total_group_count, ‘buddypress’ ), $from_num, $to_num, $total );
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • @modemlooper

    Moderator

    you can filter that text and add a string to the end

    function bp_add_text_after_groups_pagination_count( $message, $from_num, $to_num, $total ){
    
    	return $message . ' some text after';
    
    }
    add_filter( 'bp_get_groups_pagination_count', 'bp_add_text_after_groups_pagination_count', 10, 4 );

    @taraclaeys

    Participant

    Thank you! That worked!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customize bp-group-template.php’ is closed to new replies.
Skip to toolbar