Changeset 5699 for trunk/bp-xprofile/bp-xprofile-functions.php
- Timestamp:
- 02/11/2012 02:14:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-functions.php
r5329 r5699 1 1 <?php 2 /******************************************************************************** 3 * Business Functions 2 3 /** 4 * BuddyPress XProfile Filters 4 5 * 5 6 * Business functions are where all the magic happens in BuddyPress. They will … … 7 8 * hand off to a database class for data access, then return 8 9 * true or false on success or failure. 10 * 11 * @package BuddyPress 12 * @subpackage XProfileFilters 9 13 */ 10 14 … … 25 29 extract( $r, EXTR_SKIP ); 26 30 27 if ( !$name)31 if ( empty( $name ) ) 28 32 return false; 29 33 … … 79 83 80 84 // Check we have the minimum details 81 if ( !$field_group_id)85 if ( empty( $field_group_id ) ) 82 86 return false; 83 87 … … 87 91 88 92 // Instantiate a new field object 89 if ( $field_id)93 if ( !empty( $field_id ) ) 90 94 $field = new BP_XProfile_Field( $field_id ); 91 95 else … … 148 152 * @param mixed $field The ID of the field, or the $name of the field. 149 153 * @param int $user_id The ID of the user 150 * @global object $bp Global BuddyPress settings object151 154 * @uses BP_XProfile_ProfileData::get_value_byid() Fetches the value based on the params passed. 152 155 * @return mixed The profile field data. 153 156 */ 154 157 function xprofile_get_field_data( $field, $user_id = 0 ) { 155 global $bp;156 158 157 159 if ( empty( $user_id ) ) … … 216 218 } 217 219 220 $possible_values = array(); 221 218 222 // Check the value is an acceptable value 219 223 if ( 'checkbox' == $field->type || 'radio' == $field->type || 'selectbox' == $field->type || 'multiselectbox' == $field->type ) { … … 225 229 if ( is_array( $value ) ) { 226 230 foreach( $value as $i => $single ) { 227 if ( !in_array( $single, (array)$possible_values ) ) {231 if ( !in_array( $single, $possible_values ) ) { 228 232 unset( $value[$i] ); 229 233 } … … 233 237 $value = array_merge( array(), $value ); 234 238 } else { 235 if ( !in_array( $value, (array)$possible_values ) ) {239 if ( !in_array( $value, $possible_values ) ) { 236 240 return false; 237 241 } … … 301 305 */ 302 306 function xprofile_get_random_profile_data( $user_id, $exclude_fullname = true ) { 303 $field_data 304 305 if ( !$field_data)307 $field_data = BP_XProfile_ProfileData::get_random( $user_id, $exclude_fullname ); 308 309 if ( empty( $field_data ) ) 306 310 return false; 307 311 308 312 $field_data[0]->value = xprofile_format_profile_field( $field_data[0]->type, $field_data[0]->value ); 309 313 310 if ( !$field_data[0]->value ||empty( $field_data[0]->value ) )314 if ( empty( $field_data[0]->value ) ) 311 315 return false; 312 316 … … 352 356 */ 353 357 function xprofile_avatar_upload_dir( $directory = false, $user_id = 0 ) { 354 global $bp;355 358 356 359 if ( empty( $user_id ) )
Note: See TracChangeset
for help on using the changeset viewer.