wcs534
Forum Replies Created
-
Forum: Hacks
In reply to: How can I add an new item to an user's record.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 }Forum: Hacks
In reply to: How can I add an new item to an user's record.Thanks, Jerry, I am new to wordpress. I don’t know how to make plugin yet. I will try!