Make WordPress Core

Changeset 2887


Ignore:
Timestamp:
09/16/2005 05:27:09 PM (21 years ago)
Author:
matt
Message:

Fixes #1681 and the annoying empty meta problem.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r2878 r2887  
    181181        }
    182182
     183        do_action('wp_insert_post', $post_ID);
     184
    183185        return $post_ID;
    184186}
  • trunk/wp-includes/functions.php

    r2873 r2887  
    20482048
    20492049        $cur = $wpdb->get_row("SELECT * FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
    2050         if ( !$cur ) {
     2050        if ( !$cur && !empty( $meta_value ) ) {
    20512051                $wpdb->query("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
    20522052                VALUES
    … …  
    20562056        if ( $cur->meta_value != $meta_value )
    20572057                $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
     2058        if ( empty( $meta_value ) )
     2059                $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
    20582060}
    20592061
Note: See TracChangeset for help on using the changeset viewer.