Skip to:
Content

Opened 11 months ago

Closed 10 months ago

Last modified 10 months ago

#7420 closed defect (bug) (fixed)

Incorrect Format of apply_filters_ref_array for bp_get_group_name within class-bp-groups-list-table.php

Reported by: garrett-eclipse Owned by: boonebgorges
Milestone: 2.8.1 Priority: normal
Severity: normal Version: 2.7.2
Component: Groups Keywords: has-patch needs-testing
Cc:

Description

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
$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
$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

Attachments (1)

2212.patch (641 bytes) - added by 1naveengiri 10 months ago.
I added that argument in correct place in this patch.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
11 months ago

  • Component changed from Core to Groups
  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to Future Release

yep, good spot.

@1naveengiri
10 months ago

I added that argument in correct place in this patch.

#2 @1naveengiri
10 months ago

  • Keywords has-patch added; needs-patch good-first-bug removed

Hi @DJPaul,

will you please take a look. if all right in this patch please accept it. because the issue is something which errors and it should get fixed in BuddyPress asap.

Last edited 10 months ago by 1naveengiri (previous) (diff)

#3 @bhargavbhandari90
10 months ago

  • Keywords needs-testing added

This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.


10 months ago

#5 @DJPaul
10 months ago

  • Milestone changed from Future Release to 2.8.1

#6 @boonebgorges
10 months ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 11440:

Fix incorrect apply_filters_ref_array() syntax.

Introduced in [8426].

Props garrett-eclipse, 1naveengiri.
Fixes #7420.

#7 @boonebgorges
10 months ago

In 11441:

Fix incorrect apply_filters_ref_array() syntax.

Introduced in [8426].

Ports [11440] to the 2.8 branch.

Props garrett-eclipse, 1naveengiri.
Fixes #7420.

This ticket was mentioned in Slack in #buddypress by 1naveengiri. View the logs.


10 months ago

Note: See TracTickets for help on using tickets.