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: ''


Top ↑

Source Source

File: bp-xprofile/classes/class-bp-xprofile-field.php

1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
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
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.