Index: trunk/wp-content/plugins/xpressme/include/d3forum_comment_disp.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/d3forum_comment_disp.php	(revision 106)
+++ trunk/wp-content/plugins/xpressme/include/d3forum_comment_disp.php	(revision 108)
@@ -13,6 +13,22 @@
 		$forum_id = $XPressME->d3forum_forum_id;
 		$external_link_format = $XPressME->d3forum_external_link_format;
-		$db =& Database::getInstance() ;
+		if ($XPressME->is_d3forum_desc){
+			$order = 'desc';
+		} else {
+			$order = 'asc';
+		}
+		if ($XPressME->is_d3forum_desc){
+			$order = 'desc';
+		} else {
+			$order = 'asc';
+		}
 
+		if ($XPressME->is_d3forum_flat){
+			$view = 'listposts_flat';
+		} else {
+			$view = 'listtopics';
+		}
+		$posts_num = $XPressME->d3forum_views_num;
+		
 	// force UPDATE forums.forum_external_link_format "(dirname)::(classname)::(trustdirname)"
 		$xoops_db->query( "UPDATE ".get_xoops_prefix() . $dir_name."_forums SET forum_external_link_format='".$external_link_format."' WHERE forum_id= $forum_id" ) ;
@@ -33,5 +49,5 @@
         } 	
 //		$params = array("dirname" => $dir_name, "forum_id" => $forum_id, "itemname" => "p", "id" => $post_id , "subject" => $post_title);
-		$params = array("forum_id" => $forum_id,  "id" => $post_id , "subject" => $post_title);
+		$params = array("forum_id" => $forum_id,  "id" => $post_id , "subject" => $post_title , "order" => $order , "view" => $view , "posts_num" => $posts_num);
 		if(file_exists($xoops_trust_path .'/modules/d3forum/')) {
 			if(file_exists($xoops_root_path .'/modules/' . $dir_name . '/')) {
Index: trunk/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 106)
+++ trunk/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php	(revision 108)
@@ -179,5 +179,5 @@
 
 // All comments of WordPress are exported to the D3Forum comment. 
-function wp_to_d3forum($forum_id = 1, $d3f_prefix = 'd3forum' ,$wp_prefix = 'wp'){
+function wp_to_d3forum($forum_id = 1, $d3f_prefix = 'd3forum'){
 	global $XPressME,$xoops_db;
 
@@ -185,5 +185,5 @@
 	
 	$d3forum_prefix = get_xoops_prefix() . $d3f_prefix . '_';
-	$xpress_prefix = get_xoops_prefix() . $wp_prefix . '_';
+	$xpress_prefix = get_wp_prefix();
 	
 	$wp_comments = $xpress_prefix . 'comments';
@@ -239,5 +239,5 @@
 
 	$comment_count = 0;
-	$comments = $xoops_db->get_results($post_sql);
+	$comments = $xoops_db->get_results($sql);
 	foreach($comments as $comment){
 		$comment_ID = $comment->comment_ID;
@@ -253,10 +253,10 @@
 
 // All comments of D3Forum are import to the WordPress comment. 
-function d3forum_to_wp($forum_id = 1, $d3f_prefix = 'd3forum' ,$wp_prefix = 'wordpress'){
+function d3forum_to_wp($forum_id = 1, $d3f_prefix = 'd3forum'){
 	global $XPressME,$xoops_db;
 	if (!is_d3forum_setting()) die('The setting of the D3Forum comment integration is wrong. ');
 	
 	$d3forum_prefix = get_xoops_prefix() . $d3f_prefix . '_';
-	$xpress_prefix = get_xoops_prefix() . $wp_prefix . '_';
+	$xpress_prefix = get_wp_prefix() ;
 	
 	$wp_comments = $xpress_prefix . 'comments';
@@ -297,5 +297,4 @@
 
 	$d3f_res = $xoops_db->get_results($d3f_sql);
-	if (empty($d3f_res )) die( '...Err. OPEN D3Forum Data (' .  $d3f_sql . ')');
 	$import_count = 0;
 	foreach($d3f_res as $d3f_row){
@@ -429,5 +428,5 @@
 				$wp_sql .=    "($comment_ID, $post_id)";		
 				$xoops_db->query($wp_sql);				
-				if ($comment_approved ==0)	do_CommentWaiting($commentID, $post_id);
+				if ($comment_approved ==0)	do_CommentWaiting($comment_ID, $post_id);
 				break;
 			case 'edit':
