Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/19/2016 02:51:45 AM (8 years ago)
Author:
boonebgorges
Message:

XProfile: Only cache field object when query is successful.

Previously, a PHP notice was being thrown when a bad $field_id was passed
to BP_XProfile_Field::get_instance().

Props mmcachran.
Fixes #7073.

File:
1 edited

Legend:

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

    r10740 r10778  
    238238            $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ) );
    239239
    240             wp_cache_add( $field->id, $field, 'bp_xprofile_fields' );
    241 
    242240            if ( ! $field ) {
    243241                return false;
    244242            }
     243
     244            wp_cache_add( $field->id, $field, 'bp_xprofile_fields' );
    245245        }
    246246
Note: See TracChangeset for help on using the changeset viewer.