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.
-
Are you using a custom front end registration? Or are you adding users manually via the back end of the system?– NicoleCommented Nov 29, 2012 at 14:19
-
i'm adding users via the back end– JulesCommented Nov 29, 2012 at 14:29
-
@Jules Any progress on this question?– kaiserCommented Feb 9, 2013 at 1:14
-
@kaiser: i don't need this anymore. But I think Ralf912's answer is correct. Someone might want to rewrite it as a plugin.– JulesCommented Feb 12, 2013 at 10:33
1 Answer
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.
-
1