Make WordPress Core

Ticket #23482: 23482.2.patch

File 23482.2.patch, 1.2 KB (added by maxpagels, 10 years ago)

Patch for TextPattern Importer.

  • textpattern-importer.php

     
    4040        }
    4141}
    4242
     43if(!function_exists('get_comment_ID'))
     44{
     45        /**
     46         * Get the comment count for posts.
     47         *
     48         * @package WordPress
     49         * @subpackage Textpattern_Import
     50         *
     51         * @param int $post_ID Post ID
     52         * @return int
     53         */
     54        function get_comment_ID($comment_author, $comment_date)
     55        {
     56                global $wpdb;
     57                $comment_author = stripslashes($comment_author);
     58                $comment_date = stripslashes($comment_date);
     59                return $wpdb->get_var( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
     60        }
     61}
     62
    4363if(!function_exists('link_exists'))
    4464{
    4565        /**
     
    426446                                                        'comment_approved'      => $comment_approved);
    427447                                $comment = wp_filter_comment($comment);
    428448
    429                                 if ( $cinfo = comment_exists($name, $posted) ) {
     449                                if ( comment_exists($name, $posted) ) {
    430450                                        // Update comments
    431                                         $comment['comment_ID'] = $cinfo;
     451                                        $comment['comment_ID'] = get_comment_ID($name, $posted);
    432452                                        $ret_id = wp_update_comment($comment);
    433453                                } else {
    434454                                        // Insert comments