Make WordPress Core

Ticket #33871: wp-admin--includes--comments.php.diff

File wp-admin--includes--comments.php.diff, 1005 bytes (added by apokalyptik, 10 years ago)

add the function function comment_exists_gmt()

  • wp-admin/includes/comment.php

     
    88
    99/**
    1010 * Determine if a comment exists based on author and date.
     11 *
     12 * @global wpdb $wpdb WordPress database abstraction object.
    1113 *
     14 * @param string $comment_author Author of the comment
     15 * @param string $comment_date_gmt Date of the comment
     16 * @return mixed Comment post ID on success.
     17 */
     18function comment_exists_gmt( $comment_author, $comment_date_gmt ) {
     19    global $wpdb;
     20
     21    return $wpdb->get_var( $wpdb->prepare(
     22        "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_author = %s AND comment_date_gmt = %s",
     23   stripslashes( $comment_author ),
     24   stripslashes( $comment_date_gmt )
     25    ) );
     26}
     27
     28/**
     29 * Determine if a comment exists based on author and date.
     30 *
    1231 * @since 2.0.0
    1332 *
    1433 * @global wpdb $wpdb WordPress database abstraction object.