Show Biographical Info while creating new user

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.

Leave a Comment