Fixes #1681 and the annoying empty meta problem.
git-svn-id: https://develop.svn.wordpress.org/trunk@2887 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cf47e64afc
commit
6d4f063c69
@ -180,6 +180,8 @@ function wp_insert_post($postarr = array()) {
|
||||
add_post_meta($post_ID, '_wp_page_template', $page_template, true);
|
||||
}
|
||||
|
||||
do_action('wp_insert_post', $post_ID);
|
||||
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
|
@ -2047,7 +2047,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
|
||||
$meta_value = serialize($meta_value);
|
||||
|
||||
$cur = $wpdb->get_row("SELECT * FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
if ( !$cur ) {
|
||||
if ( !$cur && !empty( $meta_value ) ) {
|
||||
$wpdb->query("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
|
||||
VALUES
|
||||
( '$user_id', '$meta_key', '$meta_value' )");
|
||||
@ -2055,6 +2055,8 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
|
||||
}
|
||||
if ( $cur->meta_value != $meta_value )
|
||||
$wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
if ( empty( $meta_value ) )
|
||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
}
|
||||
|
||||
function register_activation_hook($file, $function) {
|
||||
|
Loading…
Reference in New Issue
Block a user