Index: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 419)
+++ trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php	(revision 428)
@@ -422,5 +422,5 @@
 function xpress_post_views_count($args ='') {
 	global $xoops_db,$wpdb;
-
+	global $blog_id;
 	static $post_cache_views;
 
@@ -442,6 +442,11 @@
 	if($post_id==0) return null;
 	if(!isset($post_cache_views[$post_id])){
-        $sql = "SELECT post_views FROM " . get_wp_prefix() . "views" . " WHERE post_id=$post_id";
-        $post_views = $xoops_db->get_var($sql);
+		if (is_null($blog_id)){
+			$blog_where = '';
+		} else {
+			$blog_where = ' AND blog_id = '. $blog_id;
+		}
+		$sql = "SELECT post_views FROM " . get_wp_prefix() . "views" . " WHERE post_id=$post_id " .  $blog_where;
+       $post_views = $xoops_db->get_var($sql);
         if (!$post_views) {
 	        $post_cache_views[$post_id] = 0;
@@ -473,4 +478,5 @@
 	global $xoops_db,$wpdb;
 	global $table_prefix;
+	global $blog_id;
 	static $views;
 	
@@ -481,4 +487,5 @@
 
 	$views_db = get_wp_prefix() . 'views';
+	if (is_null($blog_id)) $blog_id = 0;
 
 	if($post_id==0 || !empty($views[$post_id])) return null;
@@ -489,11 +496,19 @@
 		if ($current_user_id ==$post_author_id) return null;
 	}
-
-    $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id";
+	if (is_null($blog_id)){
+		$blog_where = '';
+	} else {
+		$blog_where = ' AND blog_id = ' . $blog_id;
+	}
+	$sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id" . $blog_where;
 	$post_views_found = $xoops_db->get_var($sql);
 	if($post_views_found){
-        $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id";
+        $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id" . $blog_where;
     }else{
-        $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)";
+    	if (is_null($blog_id)){
+			$sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)";
+		} else {
+			$sql = "INSERT INTO " . $views_db . " (blog_id, post_id, post_views) VALUES ($blog_id, $post_id, 1)";
+		}
     }
     $xoops_db->query($sql);
