Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5427 closed defect (bug) (fixed)

group_id cannot be passed to bp_group_has_invites()

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords:
Cc:

Description

It's not possible to pass a $group_id to bp_group_has_invites(). The extract( $r, EXTR_SKIP ) prevents the $group_id parameter from being populated, because the global $group_id is being invoked. In most cases, we don't notice this, because it triggers the if ( ! $group_id ) block (3160), but if you try to call from outside a group page, everything breaks.

The fact that we're passing around a $group_id global is pretty terrible. We need to do it because of how the group_id is set in BP_Groups_Invite_Template::the_invite(). This could use a better workaround, but in the meantime a simple fix is to remove the crummy call to $extract and set the global more intelligently.

https://buddypress.trac.wordpress.org/browser/trunk/bp-groups/bp-groups-template.php#L3149

Change History (2)

#1 @boonebgorges
10 years ago

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

In 7983:

Fix global variable clashes in bp_group_has_invites()

The use of extract( $r, EXTR_SKIP ) in bp_group_has_invites() was preventing
the 'group_id' parameter passed to the function from being set in the global
and from being passed to the template class. This made the function impossible
to use outside the group context.

Fixes #5427

#2 @boonebgorges
10 years ago

In 7986:

More specific assertions for bp_group_has_invites() template tests. See #5427

Note: See TracTickets for help on using tickets.