Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tooltonic

    (@tooltonic)

    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″>’;
    }
    require_once(‘../wp-includes/pluggable-functions.php’);

    add_action(‘show_user_profile’, ‘add_fields’);

    if(…) {

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

    }

    Thread Starter tooltonic

    (@tooltonic)

    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.

    code:

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

    add_action(‘show_user_profile’, ‘do_something’);

Viewing 2 replies - 1 through 2 (of 2 total)