Forum Replies Created

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

    (@wcs534)

    I did exactly as Justin Tadlock did in his tutorial. The field can be displayed. But it can’t be saved. Why? The code I put in the functions.php is as follow:

    add_action( ‘show_user_profile’, ‘my_show_extra_profile_fields’ );
    add_action( ‘edit_user_profile’, ‘my_show_extra_profile_fields’ );
    add_action( ‘personal_options_update’, ‘my_save_extra_profile_fields’ );
    add_action( ‘edit_user_profile_update’, ‘my_save_extra_profile_fields’ );

    function my_save_extra_profile_fields( $user_id ) {

    if ( !current_user_can( ‘edit_user’, $user_id ) )
    return false;

    /* Copy and paste this line for additional fields. Make sure to change ‘twitter’ to the field ID. */
    update_usermeta( $user_id, ‘usermemo’, $_POST[‘usermemo’] );
    }

    function my_show_extra_profile_fields( $user ) { ?>

    <h3>Extra profile information</h3>

    <table class=”form-table”>

    <tr>
    <th><label for=”usermemo”><?php _e(‘Memo of the User’); ?></label></th>
    <td><textarea name=”usermemo” id=”usermemo” rows=”5″ cols=”30″><?php echo $profileuser->usermemo; // textarea_escaped ?></textarea>
    <span class=”description”><?php _e(‘Keep the record of the user during his stay in this building.’); ?></span></td>
    </tr>

    </table>
    <?php }

    Thread Starter wcs534

    (@wcs534)

    Thanks, Jerry, I am new to wordpress. I don’t know how to make plugin yet. I will try!

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