Index: trunk/xpressme_integration_kit/wp-config.php
===================================================================
--- trunk/xpressme_integration_kit/wp-config.php	(revision 292)
+++ trunk/xpressme_integration_kit/wp-config.php	(revision 294)
@@ -97,4 +97,7 @@
 	require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php. 
 	require_once(ABSPATH.'wp-settings.php');
+	if (!is_object($xoopsUser)){	// before login auth cookie clear
+		wp_logout();
+	}
 	wp();
 	
Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 292)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/pluggable-override.php	(revision 294)
@@ -22,32 +22,43 @@
 
 	if ($xoopsModule){
-		if (!is_object($xoopsUser)){
+		if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST )
+			return false;
+
+		if (is_object($xoopsUser)){			// When the user is logging in xoops
+			if ( ! empty($current_user) ){
+				$xoops_user = $xoopsUser->getVar("uname");
+				if ($current_user->user_login == $xoops_user){	// If xoops login user and wordpress current user are the same
+					return;
+				}
+			}
+			if (check_xpress_auth_cookie()){	//The cookie is login user's or it checks it
+				if (function_exists('wp_validate_auth_cookie')){
+					if ( $user = wp_validate_auth_cookie() ) {
+						// When the user meta prefix is different according to the change in the xoops data base prefix, it restores it. 
+						if (!check_user_meta_prefix($user)){
+							repair_user_meta_prefix();
+						}
+						wp_set_current_user($user);
+						return ;
+					}
+				} else { // for WP2.0					
+					if ( !empty($_COOKIE[USER_COOKIE]) && !empty($_COOKIE[PASS_COOKIE])){
+						if(wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
+							$user_login = $_COOKIE[USER_COOKIE];
+							wp_set_current_user(0, $user_login);
+							return;
+						}
+					}
+				}
+			}				
+			return xpress_login();	
+		} else {							// For the xoops guest
+			if ( ! empty($current_user) ){	// When a current user of wordpress is set, a current user is cleared. 
 				wp_set_current_user(0);
-				wp_clearcookie();
-
-//				wp_logout();		 // When IE is used, it becomes page error by the guest if the wp_logout() is executed here. 
-			 	return false;
-		}
-		if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST )
-			return false;
-
-		if ( ! empty($current_user) ){
-			$xoops_user = $xoopsUser->getVar("uname");
-			if ($current_user->user_login == $xoops_user)
-				return;
-		}
-
-		if (check_xpress_auth_cookie()){	//The cookie is login user's or it checks it
-			if ( $user = wp_validate_auth_cookie() ) {
-				if (!check_user_meta_prefix($user)){
-					repair_user_meta_prefix();
-				}
-
-				wp_set_current_user($user);
-				return ;
-			}
-		}				
-		xpress_login();	
-
+				wp_logout();
+				wp_clear_auth_cookie();
+			}
+			return false;
+		}
 	} else {
 		// WP original
@@ -103,7 +114,10 @@
 		}
 	}
-	wp_set_current_user(0);
-	wp_clearcookie();
-	return 0;
+	if ( ! empty($current_user) ){
+		wp_set_current_user(0);
+		wp_logout();
+		wp_clear_auth_cookie();
+	}
+	return false;
 }
 endif;
@@ -270,4 +284,5 @@
 	@setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
 	@setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
+
 }
 endif;
