Skip to:
Content

BuddyPress.org

#8943 closed task (fixed)

Group Extension using a function to set their tab visibility & the BP Rewrites API

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 12.0.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch
Cc:

Description

Working on making bbPress ready for 12.0, I realized the way the $show_tab_callback property added to the BP_Group_Extension class during the Rewrites migrate process (see #4954) was wrong.

Plugins extending BP_Group_Extension & using a function to set their $show_tab argument will now need to use the $show_tab_callback arg instead when initing their extension using parent::init( $args ).

A function callback needs to be passed within this $show_tab_callback so that it is called once the current/displayed Groups single item is defined by BuddyPress.

This wasn't necessary in previous versions of BuddyPress because this single item was defined very early.

Change History (2)

This ticket was mentioned in PR #136 on buddypress/buddypress by @imath.


14 months ago
#1

  • Keywords has-patch added; needs-patch removed

Improve how the group tab display is performed to take in account Plugins using a function to set its visibility.

Trac ticket: https://buddypress.trac.wordpress.org/ticket/8943

#2 @imath
14 months ago

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

In 13524:

Improve the BP Rewrites API support of the Group Extension

The BP_Group_Extension::init() $args parameter (array) now accepts a new argument: $show_tab_callback. You can use this argument to inform about the callback function to use to check whether the Extension group's tab should be displayed or not. This callback function is called inside the BP_Group_Extension::setup_access_settings() to make sure to set the $show_tab argument once the current group has been defined by BuddyPress.

Third party plugin authors are strongly encouraged to use this new argument if they used to define the $show_tab argument according to the result of a function. Doing so in BuddyPress 12.0.0 won't make your extension behave as expected.

Fixes #8943
Closes https://github.com/buddypress/buddypress/pull/136

Note: See TracTickets for help on using tickets.