Pass unserializeds value to meta actions.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-04-29 19:26:40 +00:00
parent e378ebfb7f
commit e1fe1b138e
1 changed files with 5 additions and 3 deletions

View File

@ -50,6 +50,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
$meta_key, $object_id ) ) )
return false;
$_meta_value = $meta_value;
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
$wpdb->insert( $table, array(
@ -63,7 +64,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
if ( 'user' == $meta_type )
clean_user_cache($object_id);
do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $meta_value );
do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $_meta_value );
return true;
}
@ -108,6 +109,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )
return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
$_meta_value = $meta_value;
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
$data = compact( 'meta_value' );
@ -118,7 +120,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
$where['meta_value'] = $prev_value;
}
do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value );
do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
$wpdb->update( $table, $data, $where );
wp_cache_delete($object_id, $meta_type . '_meta');
@ -126,7 +128,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
if ( 'user' == $meta_type )
clean_user_cache($object_id);
do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value );
do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
return true;
}