Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7913 closed defect (bug) (fixed)

Nouveau - Ajax error while leaving the group

Reported by: dullowl Owned by: r-a-y
Priority: normal Milestone: 3.2.0
Component: Templates Version: 3.0.0
Severity: normal 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 8 years ago.

Download all attachments as: .zip

Change History (6)

#1 @elhardoum
8 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
8 years ago

  • Component CoreTemplates
  • Keywords needs-patch removed
  • Milestone Awaiting Review3.2.0
  • Summary Ajax error while leaving the groupNouveau - Ajax error while leaving the group
  • Version3.0.0

Thanks for the fix, @elhardoum. We'll address this for v3.2.0.

#3 @r-a-y
8 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
8 years ago

  • Owner set to r-a-y
  • Resolutionfixed
  • Status newclosed

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
8 years ago

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

Note: See TracTickets for help on using tickets.