Changeset 14171
- Timestamp:
- 12/26/2025 07:02:18 PM (3 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
r13890 r14171 107 107 108 108 // If the value is serializable, do not stripslashes. 109 $this->value = is_serialized( $profiledata->value ) ? $profiledata->value : stripslashes( $profiledata->value );109 $this->value = is_serialized( $profiledata->value ) ? $profiledata->value : stripslashes( $profiledata->value ); 110 110 } else { 111 111 // When no row is found, we'll need to set these properties manually. 112 $this->field_id = (int) $field_id;113 $this->user_id = (int) $user_id;112 $this->field_id = (int) $field_id; 113 $this->user_id = (int) $user_id; 114 114 } 115 115 } … … 130 130 $cache_key = "{$this->user_id}:{$this->field_id}"; 131 131 $cached = wp_cache_get( $cache_key, 'bp_xprofile_data' ); 132 $retval = false; 132 133 133 134 if ( $cached && ! empty( $cached->id ) ) { 134 135 $retval = true; 135 136 } else { 136 $bp = buddypress(); 137 $retval = $wpdb->get_row( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $this->user_id, $this->field_id ) ); 137 $bp = buddypress(); 138 $dbval = $wpdb->get_row( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $this->user_id, $this->field_id ) ); 139 140 if ( ! is_wp_error( $dbval ) && ! empty( $dbval ) ) { 141 $retval = true; 142 } 138 143 } 139 144 … … 146 151 * @param BP_XProfile_ProfileData $profile_data Instance of the current BP_XProfile_ProfileData class. 147 152 */ 148 return apply_filters_ref_array( 'xprofile_data_exists', array( (bool)$retval, $this ) );153 return (bool) apply_filters_ref_array( 'xprofile_data_exists', array( $retval, $this ) ); 149 154 } 150 155 … … 163 168 $bp = buddypress(); 164 169 $retval = $wpdb->get_row( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id ) ); 170 171 if ( is_wp_error( $retval ) || empty( $retval ) ) { 172 $retval = false; 173 } 165 174 166 175 /** … … 172 181 * @param BP_XProfile_ProfileData $profile_data Instance of the current BP_XProfile_ProfileData class. 173 182 */ 174 return apply_filters_ref_array( 'xprofile_data_is_valid_field', array( (bool)$retval, $this ) );183 return (bool) apply_filters_ref_array( 'xprofile_data_is_valid_field', array( (bool) $retval, $this ) ); 175 184 } 176 185
Note: See TracChangeset
for help on using the changeset viewer.