[buddypress-trac] [BuddyPress Trac] #7420: Incorrect Format of apply_filters_ref_array for bp_get_group_name within class-bp-groups-list-table.php

buddypress-trac noreply at wordpress.org
Thu Jan 12 00:33:28 UTC 2017


#7420: Incorrect Format of apply_filters_ref_array for bp_get_group_name within
class-bp-groups-list-table.php
-----------------------------+-----------------------------
 Reporter:  garrett-eclipse  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Core             |    Version:  2.7.2
 Severity:  normal           |   Keywords:
-----------------------------+-----------------------------
 Hello,

 I noticed this issue as I was adding a filter for bp_get_group_name and
 expecting 2 parameters but got an error on the Groups listing caused by
 the incorrect format of apply_filters_ref_array for bp_get_group_name
 within class-bp-groups-list-table.php;
 https://github.com/buddypress/BuddyPress/blob/master/src/bp-groups/classes
 /class-bp-groups-list-table.php#L523
 {{{#!php
 <?php
 $group_name = apply_filters_ref_array( 'bp_get_group_name', array(
 $item['name'] ), $item );
 }}}

 This is invalid as apply_filters_ref_array only supports two params the
 second being an array, the above provides three params.

 Code should have the $item within the array, this will allow filters to
 receive both attributes properly.

 Correct Code;
 {{{#!php
 <?php
 $group_name = apply_filters_ref_array( 'bp_get_group_name', array(
 $item['name'], $item ) );
 }}}

 *The $group param was added in 2.5 for the bp_get_group_name filter in the
 above code $item is the group.

 Thank you

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7420>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list