Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 596)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 597)
@@ -86,4 +86,55 @@
 }
 
+function onaction_trashed_post_comments($post_id){
+	global $wpdb;
+	set_d3f_topic_invisible($post_id,1);
+}
+function onaction_untrashed_post_comments($post_id){
+	global $wpdb;
+	set_d3f_topic_invisible($post_id,0);
+}
+function onaction_trashed_comment($comment_ID  = ""){
+	global $wpdb;
+	$comment_type = $wpdb->get_var("SELECT comment_type FROM $wpdb->comments WHERE comment_ID = $comment_ID");
+	if (!empty($comment_type)) return ;	
+	set_d3f_post_invisible($comment_ID,1);
+}
+function onaction_untrashed_comment($comment_ID  = ""){
+	global $wpdb;
+	$comment_type = $wpdb->get_var("SELECT comment_type FROM $wpdb->comments WHERE comment_ID = $comment_ID");
+	if (!empty($comment_type)) return ;	
+	set_d3f_post_invisible($comment_ID,0);
+}
+
+function set_d3f_topic_invisible($topic_external_link_id,$invisible){
+	global $wpdb,$xoops_db,$blog_id,$xpress_config;
+	
+	if (empty($blog_id)) $blog_id =1;
+	$d3forum_prefix = get_xoops_prefix() . $xpress_config->d3forum_module_dir . '_';
+	$d3f_topic = $d3forum_prefix . 'topics';
+	$d3f_forum_id = $xpress_config->d3forum_forum_id;
+	//xdb_d3forum_posts  where topic_external_link_id = topic_external_link_id update topic_invisible
+	
+	$sql  = "UPDATE $d3f_topic ";
+	$sql .= "SET topic_invisible = $invisible ";
+	$sql .= "WHERE topic_external_link_id = $topic_external_link_id AND forum_id = $d3f_forum_id" ;
+	$xoops_db->query($sql);
+}
+
+function set_d3f_post_invisible($wp_comment_ID, $invisible){
+	global $wpdb,$xoops_db,$blog_id,$xpress_config;
+	
+	if (empty($blog_id)) $blog_id =1;
+	$d3forum_prefix = get_xoops_prefix() . $xpress_config->d3forum_module_dir . '_';
+	$d3f_posts = $d3forum_prefix . 'posts';	// delete key topic_id
+
+	$d3f_post_id = get_d3forum_post_ID($wp_comment_ID);
+	//xdb_d3forum_posts  where post_id update invisible
+	if ($d3f_post_id){
+		$sql  =	"UPDATE  $d3f_posts SET invisible = $invisible WHERE post_id =$d3f_post_id";
+		$xoops_db->query($sql);
+	}
+}
+
 function disp_d3forum_comments($template_dir="", $file_name="")
 {
@@ -92,5 +143,4 @@
 	return $file_path;
 }
-
 
 function d3f_module_found($forum_dir ='d3forum'){		//use admin/admin_enhanced.php
Index: /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php	(revision 596)
+++ /trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php	(revision 597)
@@ -128,11 +128,13 @@
 	add_action("wp_set_comment_status" , "onaction_comment_apobe");
 	add_action("publish_post",	"onaction_comment_close");
-
-	
+	
+	// comment trashed untrashed action
+	add_action("trashed_post_comments",	"onaction_trashed_post_comments");
+	add_action("untrashed_post_comments",	"onaction_untrashed_post_comments");
+	add_action("trashed_comment",	"onaction_trashed_comment");
+	add_action("untrashed_comment",	"onaction_untrashed_comment");
+
 	add_filter('comments_template', "disp_d3forum_comments" );
-
-}
-
-
+}
 
 //The trackback and the pingback are excluded from the count of the comment. 
