public static function CanBeActive() { global $wpdb; // Number of posts? $number_of_posts = OnePanelConfig::GetNumberOfHotConversationPosts(); if (is_null($number_of_posts)) { $number_of_posts = 4; } $sql = 'SELECT pm.meta_value AS file, p.post_title, p.ID FROM ' . DB_NAME . '.' . $wpdb->prefix . 'posts p LEFT JOIN ' . DB_NAME . '.' . $wpdb->prefix . 'postmeta pm on p.ID = pm.post_id WHERE pm.meta_key = "Thumbnail" ORDER BY p.comment_count DESC LIMIT ' . $number_of_posts; $result = mysql_query($sql); if (!$result) { return false; } if (mysql_num_rows($result) < $number_of_posts) { return false; } else { return true; } }