Skip to:
Content

BuddyPress.org

Changeset 10775


Ignore:
Timestamp:
05/17/2016 08:34:39 PM (4 years ago)
Author:
boonebgorges
Message:

Use bp_get_group_name() instead of redefining filter in various places.

Reduces code duplication, and ensures that changes to filter parameters are
automatically applied to every instance of the filter.

Props garrett-eclipse.
See #6752. Fixes #7069.

Location:
trunk/src/bp-groups
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-admin.php

    r10770 r10775  
    569569    $group      = groups_get_group( 'group_id=' . (int) $_GET['gid'] );
    570570
    571     /** This filter is documented in bp-groups/bp-groups-template.php */
    572     $group_name = isset( $group->name ) ? apply_filters( 'bp_get_group_name', $group->name ) : '';
     571    $group_name = isset( $group->name ) ? bp_get_group_name( $group ) : '';
    573572
    574573    // Construct URL for form.
     
    698697        <ul class="bp-group-delete-list">
    699698        <?php foreach ( $groups['groups'] as $group ) : ?>
    700             <li><?php echo apply_filters( 'bp_get_group_name', $group->name, $group ); ?></li>
     699            <li><?php echo esc_html( bp_get_group_name( $group ) ); ?></li>
    701700        <?php endforeach; ?>
    702701        </ul>
  • trunk/src/bp-groups/bp-groups-template.php

    r10767 r10775  
    58555855     */
    58565856    function bp_get_current_group_name() {
    5857         $current_group      = groups_get_current_group();
    5858         $current_group_name = isset( $current_group->name ) ? $current_group->name : '';
    5859 
    5860         /** This filter is documented in bp-groups/bp-groups-template.php */
    5861         $name               = apply_filters( 'bp_get_group_name', $current_group_name );
     5857        $current_group = groups_get_current_group();
     5858        $current_name  = bp_get_group_name( $current_group );
    58625859
    58635860        /**
     
    58665863         * @since 1.2.0
    58675864         *
    5868          * @param string $name          Name of the current group.
     5865         * @param string $current_name  Name of the current group.
    58695866         * @param object $current_group Instance holding the current group.
    58705867         */
    5871         return apply_filters( 'bp_get_current_group_name', $name, $current_group );
     5868        return apply_filters( 'bp_get_current_group_name', $current_name, $current_group );
    58725869    }
    58735870
Note: See TracChangeset for help on using the changeset viewer.