#7913 closed defect (bug) (fixed)
Nouveau - Ajax error while leaving the group
Reported by: | dullowl | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 3.2.0 | Priority: | normal |
Severity: | normal | Version: | 3.0.0 |
Component: | Templates | Keywords: | |
Cc: |
Description
Ajax returns error Error Leaving Group. when trying to leave the group by pressing Leave group button. Here's the screen recording: https://i.imgur.com/iG36onc.gif
Buddypress version 3.1.0
WordPress version 4.9.6
Clean installation, no any other plugins or changes in the code.
Attachments (1)
Change History (6)
#2
@
6 years ago
- Component changed from Core to Templates
- Keywords needs-patch removed
- Milestone changed from Awaiting Review to 3.2.0
- Summary changed from Ajax error while leaving the group to Nouveau - Ajax error while leaving the group
- Version set to 3.0.0
Thanks for the fix, @elhardoum. We'll address this for v3.2.0.
Note: See
TracTickets for help on using
tickets.
Thanks for reporting. I believe this is a bug.
In https://buddypress.trac.wordpress.org/browser/trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php#L209 we have
if ( groups_leave_group( $group->id ) ) { $response = array( 'feedback' => sprintf( '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>', esc_html__( 'Error leaving group.', 'buddypress' ) ), 'type' => 'error', ); } else { /* more code to handle a success group leave * e.g show feedback to the user */ }
Which I believe the contributors forgot to check if the group leave function was not successful (negate their conditional check), that is when the error should be returned.
So instead it should be:
if ( ! groups_leave_group( $group->id ) ) {
This fixes the issue for me on a development environment.