CMS WordPress : modifier formulaire utilisateur
Comment ajouter des champs au formulaire « utilisateurs / users » de WordPress :
function my_new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
$contactmethods['linkedin'] = 'LinkedIn';
$contactmethods['myspace'] = 'MySpace';
$contactmethods['msn'] = 'Msn';
$contactmethods['skype'] = 'Skype';
$contactmethods['icq'] = 'ICQ';
return $contactmethods;
}
add_filter('user_contactmethods','my_new_contactmethods',10,1);
Comment ajouter des champs personnalisées au formulaire « utilisateurs / users » de wordpress :
add_action( 'show_user_profile', 'extra_user_profile_fields' );
add_action( 'edit_user_profile', 'extra_user_profile_fields' );
function extra_user_profile_fields( $user ) {
}
add_action( 'personal_options_update', 'save_extra_user_profile_fields' );
add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );
function save_extra_user_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
update_usermeta( $user_id, 'location', $_POST['location'] );
}
Source : b-website.com/ajouter-des-information-aux-profils-utilisateur-dans-wordpress