WordPress.org

Make WordPress Core

Ticket #9342: comment-cache.php

File comment-cache.php, 593 bytes (added by bobrik, 5 years ago)

Plugin to testing

Line 
1<?php
2/*
3Plugin Name: Comment Cache bug plugin
4Plugin URI: http://bobrik.name/
5Description: Shows why it buggy
6Version: 0.1
7Author: Ivan Babrou <ibobrik@gmail.com>
8Author URI: http://bobrik.name/
9*/
10
11function hoho($id)
12{
13        global $wpdb;
14        $comment = get_comment($id);
15        error_log("WRONG: ".$wpdb->get_var("SELECT comment_approved FROM wp.wp_comments WHERE comment_id = ".$id)." real, but ".$comment->comment_approved." returned by comment object");
16        return $wpdb->get_var("SELECT comment_approved FROM wp.wp_comments WHERE comment_id = ".$id);
17}
18
19add_action('wp_set_comment_status', 'hoho');
20
21?>