- Timestamp:
- 08/22/2016 10:38:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r10948 r11030 258 258 } 259 259 260 $int_fields = array( 261 'id', 'is_required', 'group_id', 'parent_id', 'is_default_option', 262 'field_order', 'option_order', 'can_delete' 263 ); 264 260 265 foreach ( $args as $k => $v ) { 261 266 if ( 'name' === $k || 'description' === $k ) { 262 267 $v = stripslashes( $v ); 263 268 } 269 270 // Cast numeric strings as integers. 271 if ( true === in_array( $k, $int_fields ) ) { 272 $v = (int) $v; 273 } 274 264 275 $this->{$k} = $v; 265 276 } … … 890 901 * 891 902 * @param string $field_name Name of the field to query the ID for. 892 * @return boolean903 * @return int|null Field ID on success; null on failure. 893 904 */ 894 905 public static function get_id_from_name( $field_name = '' ) { … … 903 914 $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s AND parent_id = 0", $field_name ); 904 915 905 return $wpdb->get_var( $sql ); 916 $query = $wpdb->get_var( $sql ); 917 918 return is_numeric( $query ) ? (int) $query : $query; 906 919 } 907 920
Note: See TracChangeset
for help on using the changeset viewer.