BP_Admin_Setting_Xprofile::callback_display_name_format()

Description

Source

File: bp-core/admin/settings/bp-admin-setting-xprofile.php

245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
public function callback_display_name_format() {
    $options = [
        'first_name'      => __( 'First Name', 'buddyboss' ),
        'first_last_name' => __( 'First Name & Last Name', 'buddyboss' ),
        'nickname'        => __( 'Nickname', 'buddyboss' ),
    ];
 
    $current_value = bp_get_option( 'bp-display-name-format' );
 
    printf( '<select name="%1$s" for="%1$s">', 'bp-display-name-format' );
        foreach ( $options as $key => $value ) {
            printf(
                '<option value="%s" %s>%s</option>',
                $key,
                $key == $current_value? 'selected' : '',
                $value
            );
        }
    printf( '</select>' );
 
    printf(
        '<p class="description">%s</p>',
        sprintf(
            __( 'After the format has been updated, remember to run <a href="%s">Repair Community</a> tools to update all the users.', 'buddyboss' ),
            add_query_arg( [
                'page' => 'bp-repair-community',
                'tab'  => 'bp-repair-community',
                'tool' => 'bp-wordpress-update-display-name'
            ], admin_url( 'admin.php' ) )
        )
    );
}

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.