Skip to:
Content

BuddyPress.org

Ticket #6090: 6090.02-formatting-only.patch

File 6090.02-formatting-only.patch, 3.5 KB (added by dcavins, 10 years ago)

Code formatting surrounding fixes in 6090.01

  • src/bp-groups/bp-groups-functions.php

    diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
    index bf321c4..a1933b3 100644
    function groups_leave_group( $group_id, $user_id = 0 ) { 
    400400function groups_join_group( $group_id, $user_id = 0 ) {
    401401        global $bp;
    402402
    403         if ( empty( $user_id ) )
     403        if ( empty( $user_id ) ) {
    404404                $user_id = bp_loggedin_user_id();
     405        }
    405406
    406407        // Check if the user has an outstanding invite. If so, delete it.
    407         if ( groups_check_user_has_invite( $user_id, $group_id ) )
     408        if ( groups_check_user_has_invite( $user_id, $group_id ) ) {
    408409                groups_delete_invite( $user_id, $group_id );
     410        }
    409411
    410412        // Check if the user has an outstanding request. If so, delete it.
    411         if ( groups_check_for_membership_request( $user_id, $group_id ) )
     413        if ( groups_check_for_membership_request( $user_id, $group_id ) ) {
    412414                groups_delete_membership_request( null, $user_id, $group_id );
     415        }
    413416
    414417        // User is already a member, just return true
    415         if ( groups_is_user_member( $user_id, $group_id ) )
     418        if ( groups_is_user_member( $user_id, $group_id ) ) {
    416419                return true;
     420        }
    417421
    418422        $new_member                = new BP_Groups_Member;
    419423        $new_member->group_id      = $group_id;
    function groups_join_group( $group_id, $user_id = 0 ) { 
    424428        $new_member->date_modified = bp_core_current_time();
    425429        $new_member->is_confirmed  = 1;
    426430
    427         if ( !$new_member->save() )
     431        if ( !$new_member->save() ) {
    428432                return false;
     433        }
    429434
    430         if ( !isset( $bp->groups->current_group ) || !$bp->groups->current_group || $group_id != $bp->groups->current_group->id )
     435        if ( !isset( $bp->groups->current_group ) || !$bp->groups->current_group || $group_id != $bp->groups->current_group->id ) {
    431436                $group = groups_get_group( array( 'group_id' => $group_id ) );
    432         else
     437        } else {
    433438                $group = $bp->groups->current_group;
     439        }
    434440
    435441        // Record this in activity streams
    436442        groups_record_activity( array(
    function groups_remove_member( $user_id, $group_id ) { 
    12171223function groups_send_membership_request( $requesting_user_id, $group_id ) {
    12181224
    12191225        // Prevent duplicate requests
    1220         if ( groups_check_for_membership_request( $requesting_user_id, $group_id ) )
     1226        if ( groups_check_for_membership_request( $requesting_user_id, $group_id ) ) {
    12211227                return false;
     1228        }
    12221229
    12231230        // Check if the user is already a member or is banned
    1224         if ( groups_is_user_member( $requesting_user_id, $group_id ) || groups_is_user_banned( $requesting_user_id, $group_id ) )
     1231        if ( groups_is_user_member( $requesting_user_id, $group_id ) || groups_is_user_banned( $requesting_user_id, $group_id ) ) {
    12251232                return false;
     1233        }
    12261234
    12271235        // Check if the user is already invited - if so, simply accept invite
    12281236        if ( groups_check_user_has_invite( $requesting_user_id, $group_id ) ) {
    function groups_reject_membership_request( $membership_id, $user_id = 0, $group_ 
    13231331 * @return bool True on success, false on failure.
    13241332 */
    13251333function groups_delete_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
    1326         if ( !empty( $user_id ) && !empty( $group_id ) )
     1334        if ( ! empty( $user_id ) && ! empty( $group_id ) ) {
    13271335                $membership = new BP_Groups_Member( $user_id, $group_id );
    1328         else
     1336        } else {
    13291337                $membership = new BP_Groups_Member( false, false, $membership_id );
     1338        }
    13301339
    1331         if ( !BP_Groups_Member::delete_request( $membership->user_id, $membership->group_id ) )
     1340        if ( ! BP_Groups_Member::delete_request( $membership->user_id, $membership->group_id ) ) {
    13321341                return false;
     1342        }
    13331343
    13341344        return $membership;
    13351345}