Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/24/2011 06:01:22 PM (14 years ago)
Author:
johnjamesjacoby
Message:

When deleting a field, do not delete the field data by default. Fixes #3888. In memory of jimgroom's lost data.

File:
1 edited

Legend:

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

    r5489 r5598  
    374374    }
    375375
    376     function delete() {
    377         global $wpdb, $bp;
    378 
    379         if ( !$this->id ||
    380             /* Prevent deletion by url when can_delete is false. */
    381             !$this->can_delete ||
    382             /* Prevent deletion of option 1 since this invalidates fields with options. */
    383             ( $this->parent_id && $this->option_order == 1 ) )
     376    function delete( $delete_data = false ) {
     377        global $wpdb, $bp;
     378
     379        // Prevent deletion if no ID is present
     380        // Prevent deletion by url when can_delete is false.
     381        // Prevent deletion of option 1 since this invalidates fields with options.
     382        if ( !$this->id || !$this->can_delete || ( $this->parent_id && $this->option_order == 1 ) )
    384383            return false;
    385384
     
    387386            return false;
    388387
    389         /* delete the data in the DB for this field */
    390         BP_XProfile_ProfileData::delete_for_field( $this->id );
     388        // delete the data in the DB for this field
     389        if ( true === $delete_data )
     390            BP_XProfile_ProfileData::delete_for_field( $this->id );
    391391
    392392        return true;
Note: See TracChangeset for help on using the changeset viewer.