BP_XProfile_Field::render_admin_form( string $message = '' )
Oupput the admin form for this field.
Description Description
Parameters Parameters
- $message
-
(Optional) Message to display.
Default value: ''
Source Source
File: bp-xprofile/classes/class-bp-xprofile-field.php
public function render_admin_form( $message = '' ) {
// Users Admin URL
$users_url = bp_get_admin_url( 'users.php' );
// Add New
if ( empty( $this->id ) ) {
$title = __( 'Add New Field', 'buddypress' );
$button = __( 'Save', 'buddypress' );
$action = add_query_arg( array(
'page' => 'bp-profile-setup',
'mode' => 'add_field',
'group_id' => (int) $this->group_id
), $users_url . '#tabs-' . (int) $this->group_id );
if ( !empty( $_POST['saveField'] ) ) {
$this->name = $_POST['title'];
$this->description = $_POST['description'];
$this->is_required = $_POST['required'];
$this->type = $_POST['fieldtype'];
$this->field_order = $_POST['field_order'];
if ( ! empty( $_POST["sort_order_{$this->type}"] ) ) {
$this->order_by = $_POST["sort_order_{$this->type}"];
}
}
// Edit
} else {
$title = __( 'Edit Field', 'buddypress' );
$button = __( 'Update', 'buddypress' );
$action = add_query_arg( array(
'page' => 'bp-profile-setup',
'mode' => 'edit_field',
'group_id' => (int) $this->group_id,
'field_id' => (int) $this->id
), $users_url . '#tabs-' . (int) $this->group_id );
} ?>
<div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1>
<?php if ( !empty( $message ) ) : ?>
<div id="message" class="error fade">
<p><?php echo esc_html( $message ); ?></p>
</div>
<?php endif; ?>
<form id="bp-xprofile-add-field" action="<?php echo esc_url( $action ); ?>" method="post">
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-<?php echo ( 1 == get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
<div id="post-body-content">
<?php
// Output the name & description fields.
$this->name_and_description(); ?>
</div><!-- #post-body-content -->
<div id="postbox-container-1" class="postbox-container">
<?php
// Output the sumbit metabox.
$this->submit_metabox( $button );
// Output the required metabox.
$this->required_metabox();
// Output the Member Types metabox.
$this->member_type_metabox();
// Output the field visibility metaboxes.
$this->visibility_metabox();
// Output the autolink metabox.
$this->autolink_metabox();
/**
* Fires after XProfile Field sidebar metabox.
*
* @since 2.2.0
*
* @param BP_XProfile_Field $this Current XProfile field.
*/
do_action( 'xprofile_field_after_sidebarbox', $this ); ?>
</div>
<div id="postbox-container-2" class="postbox-container">
<?php
/**
* Fires before XProfile Field content metabox.
*
* @since 2.3.0
*
* @param BP_XProfile_Field $this Current XProfile field.
*/
do_action( 'xprofile_field_before_contentbox', $this );
// Output the field attributes metabox.
$this->type_metabox();
// Output hidden inputs for default field.
$this->default_field_hidden_inputs();
/**
* Fires after XProfile Field content metabox.
*
* @since 2.2.0
*
* @param BP_XProfile_Field $this Current XProfile field.
*/
do_action( 'xprofile_field_after_contentbox', $this ); ?>
</div>
</div><!-- #post-body -->
</div><!-- #poststuff -->
</form>
</div>
<?php
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.9.0 | Introduced. |