BP_XProfile_Field_Type_Member_Types::admin_new_field_html( BP_XProfile_Field $current_field, string $control_type = 'radio' )
Output HTML for this field type’s children options on the wp-admin Profile Fields “Add Field” and “Edit Field” screens.
Description
Must be used inside the bp_profile_fields() template loop.
Parameters
- $current_field
-
(Required) The current profile field on the add/edit screen.
- $control_type
-
(Optional) HTML input type used to render the current field's child options.
Default value: 'radio'
Source
File: bp-xprofile/classes/class-bp-xprofile-field-type-member-types.php
public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = 'radio' ) {
$type = array_search( get_class( $this ), bp_xprofile_get_field_types() );
if ( false === $type ) {
return;
}
$class = $current_field->type != $type ? 'display: none;' : '';
$current_type_obj = bp_xprofile_create_field_type( $type );
$active_member_type = bp_get_active_member_types();
if ( empty( $active_member_type ) ) {
?>
<div id="<?php echo esc_attr( $type ); ?>" class="postbox bp-options-box" style="<?php echo esc_attr( $class ); ?> margin-top: 15px;">
<h3>
<?php
printf( '%s',
sprintf( __( 'Please make sure to add some <a href="%s">profile types</a> first.',
'buddyboss' ),
add_query_arg( [
'post_type' => bp_get_member_type_post_type(),
],
admin_url( 'edit.php' ) ) ) );
?>
</h3>
</div>
<?php
}
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.1.3 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.