diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-01 15:28:34 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-01 15:28:34 +0000 |
| commit | ca460de5458e35b012e643b2af4880312c06d0f6 (patch) | |
| tree | ebe8e430f2a863ae7b6671ea3e51ff1eaee0bb7a /wp-inst/wp-includes/functions.php | |
| parent | 814b39931c8ff188122ba77b78388b4fbe7008df (diff) | |
| download | wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.tar.gz wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.tar.xz wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.zip | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@454 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/functions.php')
| -rw-r--r-- | wp-inst/wp-includes/functions.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index 8921cb5..d53a165 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -2154,6 +2154,25 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { // FIXME: Need to delete username keyed cache object. } +function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { + global $wpdb; + if ( !is_numeric( $user_id ) ) + return false; + $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); + + if ( is_array($meta_value) || is_object($meta_value) ) + $meta_value = serialize($meta_value); + $meta_value = trim( $meta_value ); + + if ( ! empty($meta_value) ) + $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'"); + else + $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); + + wp_cache_delete($user_id, 'users'); + // FIXME: Need to delete username keyed cache object. +} + function register_activation_hook($file, $function) { $file = plugin_basename($file); |
