Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 2 years ago

Last modified 2 years 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 2 years ago.
I added that argument in correct place in this patch.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
2 years 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
2 years ago

I added that argument in correct place in this patch.

#2 @1naveengiri
2 years 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 2 years ago by 1naveengiri (previous) (diff)

#3 @bhargavbhandari90
2 years ago

  • Keywords needs-testing added

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


2 years ago

#5 @DJPaul
2 years ago

  • Milestone changed from Future Release to 2.8.1

#6 @boonebgorges
2 years 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
2 years 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.


2 years ago

Note: See TracTickets for help on using tickets.