BP_XProfile_Group::render_admin_form()
Output the admin area field group form.
Description Description
Source Source
File: bp-xprofile/classes/class-bp-xprofile-group.php
public function render_admin_form() {
global $message;
// Users Admin URL
$users_url = bp_get_admin_url( 'users.php' );
// URL to cancel to
$cancel_url = add_query_arg( array(
'page' => 'bp-profile-setup'
), $users_url );
// New field group.
if ( empty( $this->id ) ) {
$title = __( 'Add New Field Group', 'buddypress' );
$button = __( 'Save', 'buddypress' );
$action = add_query_arg( array(
'page' => 'bp-profile-setup',
'mode' => 'add_group'
), $users_url );
// Existing field group.
} else {
$title = __( 'Edit Field Group', 'buddypress' );
$button = __( 'Update', 'buddypress' );
$action = add_query_arg( array(
'page' => 'bp-profile-setup',
'mode' => 'edit_group',
'group_id' => (int) $this->id
), $users_url );
} ?>
<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-group" 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">
<div id="titlediv">
<div class="titlewrap">
<label id="title-prompt-text" for="title"><?php esc_html_e( 'Field Group Name (required)', 'buddypress') ?></label>
<input type="text" name="group_name" id="title" value="<?php echo esc_attr( $this->name ); ?>" autocomplete="off" />
</div>
</div>
<div class="postbox">
<h2><?php esc_html_e( 'Field Group Description', 'buddypress' ); ?></h2>
<div class="inside">
<label for="group_description" class="screen-reader-text"><?php
/* translators: accessibility text */
esc_html_e( 'Add description', 'buddypress' );
?></label>
<textarea name="group_description" id="group_description" rows="8" cols="60"><?php echo esc_textarea( $this->description ); ?></textarea>
</div>
</div>
<?php
/**
* Fires after the XProfile group description field is rendered in wp-admin.
*
* @since 2.6.0
*
* @param BP_XProfile_Group $this Current XProfile group.
*/
do_action( 'xprofile_group_admin_after_description', $this ); ?>
</div><!-- #post-body-content -->
<div id="postbox-container-1" class="postbox-container">
<?php
/**
* Fires before XProfile Group submit metabox.
*
* @since 2.1.0
*
* @param BP_XProfile_Group $this Current XProfile group.
*/
do_action( 'xprofile_group_before_submitbox', $this ); ?>
<div id="submitdiv" class="postbox">
<h2><?php _e( 'Submit', 'buddypress' ); ?></h2>
<div class="inside">
<div id="submitcomment" class="submitbox">
<div id="major-publishing-actions">
<?php
// Nonce fields
wp_nonce_field( 'bp_xprofile_admin_group', 'bp_xprofile_admin_group' );
/**
* Fires at the beginning of the XProfile Group publishing actions section.
*
* @since 2.1.0
*
* @param BP_XProfile_Group $this Current XProfile group.
*/
do_action( 'xprofile_group_submitbox_start', $this ); ?>
<input type="hidden" name="group_order" id="group_order" value="<?php echo esc_attr( $this->group_order ); ?>" />
<div id="publishing-action">
<input type="submit" name="save_group" value="<?php echo esc_attr( $button ); ?>" class="button-primary"/>
</div>
<div id="delete-action">
<a href="<?php echo esc_url( $cancel_url ); ?>" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?php
/**
* Fires after XProfile Group submit metabox.
*
* @since 2.1.0
*
* @param BP_XProfile_Group $this Current XProfile group.
*/
do_action( 'xprofile_group_after_submitbox', $this ); ?>
</div>
</div>
</div>
</form>
</div>
<?php
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |