mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-18 04:25:07 +00:00
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:
parent
e378ebfb7f
commit
e1fe1b138e
@ -50,6 +50,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
|
|||||||
$meta_key, $object_id ) ) )
|
$meta_key, $object_id ) ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$_meta_value = $meta_value;
|
||||||
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
||||||
|
|
||||||
$wpdb->insert( $table, array(
|
$wpdb->insert( $table, array(
|
||||||
@ -63,7 +64,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
|
|||||||
if ( 'user' == $meta_type )
|
if ( 'user' == $meta_type )
|
||||||
clean_user_cache($object_id);
|
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;
|
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 ) ) )
|
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);
|
return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
|
||||||
|
|
||||||
|
$_meta_value = $meta_value;
|
||||||
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
||||||
|
|
||||||
$data = compact( '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;
|
$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 );
|
$wpdb->update( $table, $data, $where );
|
||||||
wp_cache_delete($object_id, $meta_type . '_meta');
|
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 )
|
if ( 'user' == $meta_type )
|
||||||
clean_user_cache($object_id);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user