Skip to:
Content

BuddyPress.org

Ticket #7401: 7401.2.diff

File 7401.2.diff, 3.0 KB (added by boonebgorges, 8 years ago)
  • src/bp-xprofile/bp-xprofile-functions.php

    diff --git src/bp-xprofile/bp-xprofile-functions.php src/bp-xprofile/bp-xprofile-functions.php
    index 716c335..587dc79 100644
    function xprofile_insert_field( $args = '' ) { 
    286286 * @param int|object $field ID of the field or object representing field data.
    287287 * @return BP_XProfile_Field|null Field object if found, otherwise null.
    288288 */
    289 function xprofile_get_field( $field ) {
     289function xprofile_get_field( $field, $user_id = null, $get_data = true ) {
    290290        if ( $field instanceof BP_XProfile_Field ) {
    291291                $_field = $field;
    292292        } elseif ( is_object( $field ) ) {
    293293                $_field = new BP_XProfile_Field();
    294294                $_field->fill_data( $field );
    295295        } else {
    296                 $_field = BP_XProfile_Field::get_instance( $field );
     296                $_field = BP_XProfile_Field::get_instance( $field, $user_id, $get_data );
    297297        }
    298298
    299299        if ( ! $_field ) {
  • src/bp-xprofile/classes/class-bp-xprofile-field.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field.php src/bp-xprofile/classes/class-bp-xprofile-field.php
    index bb75f29..16cf3e6 100644
    class BP_XProfile_Field { 
    233233         * @param int $field_id ID of the field.
    234234         * @return BP_XProfile_Field|false Field object if found, otherwise false.
    235235         */
    236         public static function get_instance( $field_id ) {
     236        public static function get_instance( $field_id, $user_id = null, $get_data = true ) {
    237237                global $wpdb;
    238238
    239239                $field_id = (int) $field_id;
    class BP_XProfile_Field { 
    241241                        return false;
    242242                }
    243243
    244                 return new self( $field_id );
     244                return new self( $field_id, $user_id, $get_data );
    245245        }
    246246
    247247        /**
  • src/bp-xprofile/classes/class-bp-xprofile-group.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-group.php src/bp-xprofile/classes/class-bp-xprofile-group.php
    index a3934a5..aca4c32 100644
    class BP_XProfile_Group { 
    396396                // Pull field objects from the cache.
    397397                $fields = array();
    398398                foreach ( $field_ids as $field_id ) {
    399                         $fields[] = xprofile_get_field( $field_id );
     399                        $fields[] = xprofile_get_field( $field_id, null, false );
    400400                }
    401401
    402402                // Store field IDs for meta cache priming.
    class BP_XProfile_Group { 
    446446
    447447                                        // Loop through the data in each field.
    448448                                        foreach( (array) $field_data as $data ) {
    449 
    450449                                                // Assign correct data value to the field.
    451450                                                if ( $field->id == $data->field_id ) {
    452451                                                        $fields[ $field_key ]->data        = new stdClass;
  • src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-profiledata.php src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
    index 8dc10f9..d0b1b7b 100644
    class BP_XProfile_ProfileData { 
    489489                                        $d = new stdClass;
    490490                                        $d->id           = '';
    491491                                        $d->user_id      = $id;
    492                                         $d->field_id     = '';
     492                                        $d->field_id     = $field_id;
    493493                                        $d->value        = '';
    494494                                        $d->last_updated = '';
    495495                                }