Skip to:
Content

BuddyPress.org

Changeset 5961


Ignore:
Timestamp:
04/06/2012 10:44:11 PM (14 years ago)
Author:
djpaul
Message:

Make sure ID property is set in Group object when Group is saved. Fixes #4105, props augustknight

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r5926 r5961  
    4545                $this->description = apply_filters( 'xprofile_group_description_before_save', $this->description, $this->id );
    4646
    47                 do_action_ref_array( 'xprofile_group_before_save', array( $this ) );
    48 
    49                 if ( !empty( $this->id ) )
     47                do_action_ref_array( 'xprofile_group_before_save', array( &$this ) );
     48
     49                if ( $this->id )
    5050                        $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id );
    5151                else
     
    5555                        return false;
    5656
    57                 do_action_ref_array( 'xprofile_group_after_save', array( $this ) );
    58 
    59                 if ( !empty( $this->id ) )
    60                         return $this->id;
    61                 else
    62                         return $wpdb->insert_id;
     57                // If not set, update the ID in the group object
     58                if ( ! $this->id )
     59                        $this->id = $wpdb->insert_id;
     60
     61                do_action_ref_array( 'xprofile_group_after_save', array( &$this ) );
     62
     63                return $this->id;
    6364        }
    6465
Note: See TracChangeset for help on using the changeset viewer.