Skip to:
Content

BuddyPress.org

Changeset 4032


Ignore:
Timestamp:
02/11/2011 09:37:30 PM (14 years ago)
Author:
djpaul
Message:

Set ID in BP_XProfile_ProfileData class when a new value is set. Fixes #3044

File:
1 edited

Legend:

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

    r3908 r4032  
    794794
    795795        if ( $this->is_valid_field() ) {
    796             if ( $this->exists() && !empty( $this->value ) && strlen( trim( $this->value ) ) )
    797                 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ) );
    798 
    799             /* Data removed, delete the entry. */
    800             else if ( $this->exists() && empty( $this->value ) )
    801                 $result = $this->delete();
    802 
    803             else
    804                 $result = $wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated ) );
     796            if ( $this->exists() && !empty( $this->value ) && strlen( trim( $this->value ) ) ) {
     797                $result   = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ) );
     798
     799            } else if ( $this->exists() && empty( $this->value ) ) {
     800                // Data removed, delete the entry.
     801                $result   = $this->delete();
     802
     803            } else {
     804                $result   = $wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated ) );
     805                $this->id = $wpdb->insert_id;
     806            }
    805807
    806808            if ( !$result )
Note: See TracChangeset for help on using the changeset viewer.