Skip to content

Commit

Permalink
Delete usermeta field if set to empty string. Props David House. fixe…
Browse files Browse the repository at this point in the history
…s #2341

git-svn-id: http://svn.automattic.com/wordpress/trunk@3495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Jan 29, 2006
1 parent cd678d9 commit 325a641
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wp-includes/functions.php
Expand Up @@ -2219,6 +2219,10 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
if ( is_array($meta_value) || is_object($meta_value) )
$meta_value = serialize($meta_value);
$meta_value = trim( $meta_value );

if (empty($meta_value)) {
delete_usermeta($user_id, $meta_key);
}

$cur = $wpdb->get_row("SELECT * FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
if ( !$cur ) {
Expand Down

0 comments on commit 325a641

Please sign in to comment.