Skip to:
Content

BuddyPress.org

Changeset 8165


Ignore:
Timestamp:
03/26/2014 09:44:30 PM (10 years ago)
Author:
djpaul
Message:

xProfile: fix logic error in the BP_XProfile_ProfileData class' populate() method where the field's data wasn't being set correctly if it was already in cache.

File:
1 edited

Legend:

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

    r8022 r8165  
    11271127        if ( false === $profiledata ) {
    11281128            $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id );
    1129 
    1130             if ( $profiledata = $wpdb->get_row( $sql ) ) {
    1131                 $this->id           = $profiledata->id;
    1132                 $this->user_id      = $profiledata->user_id;
    1133                 $this->field_id     = $profiledata->field_id;
    1134                 $this->value        = stripslashes( $profiledata->value );
    1135                 $this->last_updated = $profiledata->last_updated;
    1136 
     1129            $profiledata = $wpdb->get_row( $sql );
     1130
     1131            if ( $profiledata ) {
    11371132                wp_cache_set( $field_id, $profiledata, $cache_group );
    1138             } else {
    1139                 // When no row is found, we'll need to set these properties manually
    1140                 $this->field_id     = $field_id;
    1141                 $this->user_id      = $user_id;
    1142             }
     1133            }
     1134        }
     1135
     1136        if ( $profiledata ) {
     1137            $this->id           = $profiledata->id;
     1138            $this->user_id      = $profiledata->user_id;
     1139            $this->field_id     = $profiledata->field_id;
     1140            $this->value        = stripslashes( $profiledata->value );
     1141            $this->last_updated = $profiledata->last_updated;
     1142
     1143        } else {
     1144            // When no row is found, we'll need to set these properties manually
     1145            $this->field_id     = $field_id;
     1146            $this->user_id      = $user_id;
    11431147        }
    11441148    }
Note: See TracChangeset for help on using the changeset viewer.