Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7913 closed defect (bug) (fixed)

Nouveau - Ajax error while leaving the group

Reported by: dullowl's profile dullowl Owned by: r-a-y's profile 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)

2018-07-04-15-37-58.gif (440.0 KB) - added by dullowl 6 years ago.

Download all attachments as: .zip

Change History (6)

#1 @elhardoum
6 years ago

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.

#2 @r-a-y
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.

#3 @r-a-y
6 years ago

In 12190:

Nouveau: Fix wrong error message showing when leaving a group via AJAX.

Props elhardoum, dullowl.

See #7913 (trunk)

#4 @r-a-y
6 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 12191:

Nouveau: Fix wrong error message showing when leaving a group via AJAX.

Props elhardoum, dullowl.

Fixes #7913 (3.x branch)

#5 @r-a-y
6 years ago

Thanks for the report, @dullowl, and thanks for the fix, @elhardoum !

Note: See TracTickets for help on using tickets.