Make WordPress Core

Ticket #23482: 23482.patch

File 23482.patch, 1.3 KB (added by maxpagels, 10 years ago)

Patch for DotClear Importer

  • dotclear-importer.php

     
    3333        }
    3434}
    3535
     36if(!function_exists('get_comment_ID'))
     37{
     38        /**
     39         * Get the comment count for posts.
     40         *
     41         * @package WordPress
     42         * @subpackage Textpattern_Import
     43         *
     44         * @param int $post_ID Post ID
     45         * @return int
     46         */
     47        function get_comment_ID($comment_author, $comment_date)
     48        {
     49                global $wpdb;
     50                $comment_author = stripslashes($comment_author);
     51                $comment_date = stripslashes($comment_date);
     52                return $wpdb->get_var( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
     53        }
     54}
     55
    3656if (!function_exists('link_exists')) {
    3757        /**
    3858         * Check whether link already exists.
     
    413433                                                        'comment_approved'      => $comment_approved);
    414434                                $comment = wp_filter_comment($comment);
    415435
    416                                 if ( $cinfo = comment_exists($name, $comment_dt) ) {
     436                                if ( comment_exists($name, $comment_dt) ) {
    417437                                        // Update comments
    418                                         $comment['comment_ID'] = $cinfo;
     438                                        $comment['comment_ID'] = get_comment_ID($name, $comment_dt);
    419439                                        $ret_id = wp_update_comment($comment);
    420440                                } else {
    421441                                        // Insert comments