xprofile_admin_field( BP_XProfile_Field $admin_field, object $admin_group, string $class = '', bool $is_signup = false )
Handles the WYSIWYG display of each profile field on the edit screen.
Description Description
Parameters Parameters
- $admin_field
-
(Required) Admin field.
- $admin_group
-
(Required) Admin group object.
- $class
-
(Optional) Classes to append to output.
Default value: ''
- $is_signup
-
(Optional) Whether the admin field output is made inside the signup group.
Default value: false
Source Source
File: bp-xprofile/bp-xprofile-admin.php
function xprofile_admin_field( $admin_field, $admin_group, $class = '' ) { global $field; $field = $admin_field; // Users admin URL $url = bp_get_admin_url( 'users.php' ); // Edit $field_edit_url = add_query_arg( array( 'page' => 'bp-profile-setup', 'mode' => 'edit_field', 'group_id' => (int) $field->group_id, 'field_id' => (int) $field->id ), $url ); // Delete if ( $field->can_delete ) { $field_delete_url = add_query_arg( array( 'page' => 'bp-profile-setup', 'mode' => 'delete_field', 'field_id' => (int) $field->id ), $url . '#tabs-' . (int) $field->group_id ); } ?> <fieldset id="draggable_field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>"> <legend> <span> <?php bp_the_profile_field_name(); ?> <?php if ( empty( $field->can_delete ) ) : ?><?php esc_html_e( '(Primary)', 'buddypress' ); endif; ?> <?php bp_the_profile_field_required_label(); ?> <?php if ( bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ) ) : ?><?php esc_html_e( '(Sign-up)', 'buddypress' ); endif; ?> <?php if ( bp_get_member_types() ) : echo $field->get_member_type_label(); endif; ?> <?php /** * Fires at end of legend above the name field in base xprofile group. * * @since 2.2.0 * * @param BP_XProfile_Field $field Current BP_XProfile_Field * object being rendered. */ do_action( 'xprofile_admin_field_name_legend', $field ); ?> </span> </legend> <div class="field-wrapper"> <?php if ( in_array( $field->type, array_keys( bp_xprofile_get_field_types() ) ) ) { $field_type = bp_xprofile_create_field_type( $field->type ); $field_type->admin_field_html(); } else { /** * Fires after the input if the current field is not in default field types. * * @since 1.5.0 * * @param BP_XProfile_Field $field Current BP_XProfile_Field * object being rendered. * @param int $value Integer 1. */ do_action( 'xprofile_admin_field', $field, 1 ); } ?> <?php if ( $field->description ) : ?> <p class="description"><?php echo esc_attr( $field->description ); ?></p> <?php endif; ?> <div class="actions"> <a class="button edit" href="<?php echo esc_url( $field_edit_url ); ?>"><?php _ex( 'Edit', 'Edit field link', 'buddypress' ); ?></a> <?php if ( $field->can_delete ) : ?> <div class="delete-button"> <a class="confirm submit-delete deletion" href="<?php echo esc_url( wp_nonce_url( $field_delete_url, 'bp_xprofile_delete_field-' . $field->id, 'bp_xprofile_delete_field' ) ); ?>"><?php _ex( 'Delete', 'Delete field link', 'buddypress' ); ?></a> </div> <?php endif; ?> <?php /** * Fires at end of field management links in xprofile management admin. * * @since 2.2.0 * * @param BP_XProfile_Group $group BP_XProfile_Group object * for the current group. */ do_action( 'xprofile_admin_field_action', $field ); ?> </div> </div> </fieldset> <?php }
Changelog Changelog
Version | Description |
---|---|
8.0.0 | Adds the $is_signup parameter. |
1.5.0 | Introduced. |