Show Biographical Info while creating new user

Is it possible to show the Biographical Info textfield while creating a new user?
I know it’s possible to add user bio by editing a user AFTER it has been created. But I would like to do this while creating the user.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

No. There are no hooks or filters to add an input field to the create user form.

Maybe it is possible to add an input field via jQuery. I have not tested it.

If it is pssible to add an input field, than it should be possible to save this information because the process of creating an user is the same as updating an existing user.

Update

Yes, it is possible to add an input field with jQuery. And yes, it is possible to add extra data to the user creation.

As long as you use the same fields which are on the edit user screen, it’s only a hand full lines of code:

PHP

add_action( 'admin_print_scripts-user-new.php', 'add_jquery' );

function add_jquery(){

    wp_enqueue_script(
        'add_input_field',
        plugins_url( 'stackexchange.js', __FILE__ ),
        array( 'jquery' ),
        false,
        true
    );

}

JS

jQuery( document ).ready(

    function($){

        var insertElements = 
            '<tr class="form-field">' +
            '   <th scope="row"><label for="description">Biographical Info</label></th>' +
            '   <td><textarea name="description" id="description" rows="5" cols="30"></textarea><br /><span class="description">Share a little biographical information to fill out your profile. This may be shown publicly.</span></td>' +
            '</tr>';

        $( '#createuser .form-table tbody' ).append( insertElements );

    }

);

I simply enqueued a javascript file to the new user screen. In this javascript, the markup for the table row and input field is appended to the table.

In this example I just copy the markup from the edit user screen. So there is no need to do anything else because, as i mentioned above, creating an user is the same process as editing an user.

If you wish to create your own field (e.g. a field for a link to a twitter profile), than you have to hook into the edit users data and show users data. There are a lot of very good examples and tutorials on the net about this topic. One you can finde at WP Engineers.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply