Skip to:
Content

BuddyPress.org

Opened 3 months ago

Closed 3 months ago

#8567 closed defect (bug) (fixed)

Newly introduced `bp_get_group()` should be less restrictive checking the Group object

Reported by: imath Owned by: imath
Milestone: 10.0.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch commit
Cc:

Description

When listing Groups within the Groups WP Administration screen bp_get_group_permalink() is generating a notice error since [13085]. Reason is the BP_Groups_List_Table is not using a BP_Groups_Group but a standard object. As it's possible to use a custom class to set a Group object (see https://buddypress.trac.wordpress.org/browser/trunk/src/bp-groups/classes/class-bp-groups-component.php#L251) I believe we should allow a regular object having an id property.

Attachments (1)

8567.patch (1.2 KB) - added by imath 3 months ago.

Download all attachments as: .zip

Change History (6)

@imath
3 months ago

#1 @imath
3 months ago

@espellcaste what do you think of it ^^ ?

#2 @espellcaste
3 months ago

My only concern there is that you can pass an object which might not be actually a BP_Groups_Group object.

What about updating $view_url = bp_get_group_permalink( $item_obj ); and pass the object ID instead of the object itself?

I'm fine with either option. But I'd lean on updating the column_comment method.

#3 @espellcaste
3 months ago

By the way, your approach saves a db query, so that makes a bit of more sense.

#4 @imath
3 months ago

  • Keywords commit added

Ok, thanks a lot for your feedback 👍

#5 @imath
3 months ago

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

In 13107:

Be less restrictive when checking the Group object in bp_get_group()

  1. The Groups WP Admin Screen is using a standard object to build Groups permalink.
  2. The current Group's object can be set using a different class than BP_Groups_Group using the 'bp_groups_current_group_class' filter.

For this 2 reasons, we need to adapt bp_get_group() so that a standard object having an id property can be used as the $group function's parameter.

Props espellcaste

Fixes #8567

Note: See TracTickets for help on using tickets.