Ticket #6959: 6959.patch
File 6959.patch, 2.9 KB (added by , 9 years ago) |
---|
-
src/bp-xprofile/bp-xprofile-caps.php
34 34 $field_id = isset( $args[0] ) ? (int)$args[0] : bp_get_the_profile_field_id(); 35 35 $profile_user_id = isset( $args[1] ) ? (int)$args[1] : bp_displayed_user_id(); 36 36 37 // Visibility on the fullnamefield is not editable.38 if ( 1 == $field_id) {37 // Visibility on the default field is not editable. 38 if ( bp_xprofile_is_default_field( $field_id ) ) { 39 39 $caps[] = 'do_not_allow'; 40 40 break; 41 41 } -
src/bp-xprofile/bp-xprofile-functions.php
1244 1244 1245 1245 return $field_ids; 1246 1246 } 1247 1248 /** 1249 * Return if a field is the default field (by ID). 1250 * 1251 * @since 2.6.0 1252 * 1253 * @param int $field_id ID of field to check. 1254 * @return bool 1255 */ 1256 function bp_xprofile_is_default_field( $field_id ) { 1257 /** 1258 * Filters the default status of a particular field. 1259 * 1260 * @since 2.6.0 1261 * 1262 * @param int $field_id ID of a default field. 1263 */ 1264 return apply_filters( 'bp_xprofile_is_default_field', (bool) ( 1 === (int) $field_id ), $field_id ); 1265 } 1266 1267 /** 1268 * Return if a fields group is the default group (by ID). 1269 * 1270 * @since 2.6.0 1271 * 1272 * @param int $group_id ID of group to check. 1273 * @return bool 1274 */ 1275 function bp_xprofile_is_default_group( $group_id ) { 1276 /** 1277 * Filters the default status of a particular fields group. 1278 * 1279 * @since 2.6.0 1280 * 1281 * @param int $group_id ID of a default group. 1282 */ 1283 return apply_filters( 'bp_xprofile_is_default_group', (bool) ( 1 === (int) $group_id ), $group_id ); 1284 } -
src/bp-xprofile/classes/class-bp-xprofile-field.php
703 703 * @return string 704 704 */ 705 705 public function get_member_type_label() { 706 // Field 1 is always displayed to everyone, so never getsa label.707 if ( 1 == $this->id) {706 // Default fields are always displayed to everyone, so never get a label. 707 if ( bp_xprofile_is_default_field( $this->id ) ) { 708 708 return ''; 709 709 } 710 710 … … 1326 1326 */ 1327 1327 private function member_type_metabox() { 1328 1328 1329 // The primary field isfor all, so bail.1330 if ( 1 === (int) $this->id) {1329 // The primary fields are for all, so bail. 1330 if ( bp_xprofile_is_default_field( $this->id ) ) { 1331 1331 return; 1332 1332 } 1333 1333 … … 1548 1548 } 1549 1549 1550 1550 // Compare & return. 1551 return (bool) ( 1 === (int)$field_id );1551 return bp_xprofile_is_default_field( $field_id ); 1552 1552 } 1553 1553 }