Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

#7069 closed defect (bug) (fixed)

$group object should be supplied to bp_get_group_name filter in bp-groups-admin.php

Reported by: garrett-eclipse's profile garrett-eclipse Owned by: boonebgorges's profile boonebgorges
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5.0
Component: Groups Keywords:
Cc:

Description

In BP 2.5 the $group object was supplied to the bp_get_group_name filter as outlined in this ticket;
https://buddypress.trac.wordpress.org/ticket/6752

I noticed in bp-groups-admin.php there's a reference to this filter but it's missing the $group object;

<?php
$group_name = isset( $group->name ) ? apply_filters( 'bp_get_group_name', $group->name ) : '';

https://github.com/buddypress/BuddyPress/blob/f8dd8be7fca91a591614b65e3d515ce984efc16c/src/bp-groups/bp-groups-admin.php#L572

Will need to be updated to also supply the $group object.

Thanks

Change History (4)

#1 @garrett-eclipse
8 years ago

I found another instance in bp-groups-template.php;

<?php
/** This filter is documented in bp-groups/bp-groups-template.php */
$name               = apply_filters( 'bp_get_group_name', $current_group_name );

The apply_filters should include $current_group as the group object in this case as follows;

<?php
/** This filter is documented in bp-groups/bp-groups-template.php */
$name               = apply_filters( 'bp_get_group_name', $current_group_name, $current_group );

Cheers

#2 @boonebgorges
8 years ago

  • Milestone changed from Awaiting Review to 2.6
  • Owner set to boonebgorges
  • Status changed from new to accepted

Thanks for the report. Why are we not using the bp_get_group_name() functions in these locations? That's better than redefining the filter everywhere.

#3 @garrett-eclipse
8 years ago

Agreed, makes more sense to utilize the already filtered function.

#4 @boonebgorges
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 10775:

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.

Note: See TracTickets for help on using tickets.