this is my code
/* Update user information. */
if ( !empty( $_POST['url'] ) ){
update_user_meta( $current_user->id, 'user_url', esc_url( $_POST['url'] ) );
else{
delete_user_meta( $current_user->id, 'user_url');
}
if ( !empty( $_POST['twit'] ) ){
update_user_meta( $current_user->id, 'twitter', esc_attr( $_POST['twit'] ) );
else{
delete_user_meta( $current_user->id, 'twitter');
}
if ( !empty( $_POST['face'] ) ){
update_user_meta( $current_user->id, 'facebook', esc_attr( $_POST['face'] ) );
else{
delete_user_meta( $current_user->id, 'facebook');
}
if ( !empty( $_POST['gplus'] ) ){
update_user_meta( $current_user->id, 'googleplus', esc_url( $_POST['gplus'] ) );
else{
delete_user_meta( $current_user->id, 'googleplus');
}
if ( !empty( $_POST['email'] ) )
update_user_meta( $current_user->id, 'user_email', esc_attr( $_POST['email'] ) );
if ( !empty( $_POST['first-name'] ) ){
update_user_meta( $current_user->id, 'first_name', esc_attr( $_POST['first-name'] ) );
else{
delete_user_meta( $current_user->id, 'first_name');
}
if ( !empty( $_POST['last-name'] ) ){
update_user_meta($current_user->id, 'last_name', esc_attr( $_POST['last-name'] ) );
else{
delete_user_meta( $current_user->id, 'last_name');
}
if ( !empty( $_POST['display_name'] ) )
update_user_meta($current_user->id, 'display_name', esc_attr( $_POST['display_name'] ) );
if ( !empty( $_POST['description'] ) ){
update_user_meta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );
else{
delete_user_meta( $current_user->id, 'description');
}
but it gives me server error. it doesnt work. what is wrong with my code? thanks.
WP_DEBUG
and get your server to output errors. A server error could literally be anything, you have to tell us what the error is. Also, the context of where you're using this code might help as well.Parse error: syntax error, unexpected T_ELSE in /srv/www/domain.com/public_html/wp-content/themes/mytheme/user_profile_update.php on line 25
and line 25 is the first else statement in the aboce code.