Function Reference: geodir_wpml_duplicate_comment_exists

Summary

Get the WPML duplicate comment ID of the comment.

Global Values

$dup_post_id
(object) (required) WordPress Database object.

Default: None

Parameters

$dup_post_id
(int) (required) The duplicate post ID.

Default: None
$original_cid
(int) (required) The original Comment ID.

Default: None

Return Values

(int)
  • The duplicate comment ID.

Change Log

Since: 1.6.16

Source File

geodir_wpml_duplicate_comment_exists() is located in geodirectory-functions/custom_functions.php [Line: 2902]

Source Code

function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
	global $wpdb;

	$duplicate = $wpdb->get_var(
		$wpdb->prepare(
			"   SELECT comm.comment_ID
                FROM {$wpdb->comments} comm
                JOIN {$wpdb->commentmeta} cm
                    ON comm.comment_ID = cm.comment_id
                WHERE comm.comment_post_ID = %d
                    AND cm.meta_key = '_icl_duplicate_of'
                    AND cm.meta_value = %d
                LIMIT 1",
			$dup_post_id,
			$original_cid
		)
	);

	return $duplicate;
}