Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
add_action( 'user_new_form', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<table class="form-table">
<tr>
<th><label for="twitter">Cumpleaños</label></th>
<td>
<input type="text" name="bday" id="bday" value="<?php echo esc_attr( get_the_author_meta( 'bday', $user->ID ) ); ?>" class="regular-text" /><br />
</td>
</tr>
</table>
<?php }
add_action( 'user_register', 'my_save_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;
update_usermeta( $user_id, 'bday', $_POST['bday'] );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment