[buddypress-trac] [BuddyPress Trac] #7913: Ajax error while leaving the group

buddypress-trac noreply at wordpress.org
Thu Jul 5 09:24:43 UTC 2018


#7913: Ajax error while leaving the group
--------------------------+------------------------------
 Reporter:  dullowl       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Core          |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------

Comment (by elhardoum):

 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

 {{{#!php
 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:

 {{{#!php
 if ( ! groups_leave_group( $group->id ) ) {
 }}}

 This fixes the issue for me on a development environment.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7913#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list