[buddypress-trac] [BuddyPress Trac] #7386: BP_Group_Extension: Create screen is not passed the new group ID.
buddypress-trac
noreply at wordpress.org
Mon Dec 12 17:38:58 UTC 2016
#7386: BP_Group_Extension: Create screen is not passed the new group ID.
--------------------------+-----------------------
Reporter: dcavins | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: Groups | Version: 2.7.2
Severity: normal | Keywords: has-patch
--------------------------+-----------------------
When building a new group extension, the `create_screen( $group_id = null
)` signature suggests that a group ID will be passed to your method (or
the catch-all `edit_screen()`). The group extension's group ID is
calculated in `BP_Group_Extension::get_group_id()`, which uses
`bp_get_new_group_id()` (a fetcher for `$bp->groups->new_group_id`) on the
create screens. However, `$bp->groups->new_group_id` isn't set until
`add_action( 'bp_actions', 'groups_action_create_group' )` which is much
later than most group extensions are loaded (often on `plugins_loaded`).
I'm attaching the simplest patch I could think of, which adds a cookie
check to `BP_Group_Extension::get_group_id()`. We could also change the
action on which `groups_action_create_group()` is fired to something much
earlier, but this seems perilous. We could also revisit the group creation
steps entirely, I guess.
Thanks for your feedback!
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7386>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list