Support » Plugins » adding new fields/infos to the user profile – action hooks…

Viewing 4 replies - 1 through 4 (of 4 total)
  • You could try:

    update_usermeta( $user_id, 'field-name', $value);

    To update the usermeta data, and get_usermeta to retreive it.

    thanx for the answer – it seems to work – but i have some problems: in the ‘wp_usermeta’ mysql-table it creates an entry with the meta_key i used, but i cannot print or load any of the posted data of my form-field. $_POST[] is empty at this point. also i cannot get the $user_id in my function. wordpress put out my plugin in user_edit.php – in page ‘Your Profil’ after the normal fields in the end of the form.


    function do_something() {
    echo ‘<input type=”text” name=”test” size=”95″>’;
    update_usermeta( 1, ‘new_meta’, $test);

    add_action(‘show_user_profile’, ‘do_something’);

    ok – i found the error – i called the function ‘update_usermeta()’ at the wrong place (see code below for the correction). To work with the function ‘update_usermeta()’ – i have to include another page of functions, because i get an error message that a function ‘get_userdata()’ is not defined:

    ‘Fatal error: Call to undefined function get_userdata() in C:\htdocs\wordpress\wp-includes\functions.php on line 2238’.

    So i decide to include the missing file (pluggable-functions.php) with ‘require_once()’ and hope that it works in the future?!

    function add_fields() {
    echo ‘<input type=”text” name=”test” size=”95″>’;

    add_action(‘show_user_profile’, ‘add_fields’);

    if(…) {

    update_usermeta($_POST[checkuser_id], ‘test’, $_POST[test]);



    As it seems to work now, is it possible to get the whole code of your plugin ?
    I want to exactly do the same and since I’ve never done any plugin, it will help me.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘adding new fields/infos to the user profile – action hooks…’ is closed to new replies.