Index: trunk/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 154)
+++ trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 155)
@@ -1,3 +1,17 @@
 <?php
+function xpress_selected_author($show=true ) {
+	$output = '';
+  	$author_cookie = get_xpress_dir_name() . "_select_author" ;
+  	if (!empty($_COOKIE[$author_cookie])){
+  		$uid = intval($_COOKIE[$author_cookie]);
+  		$user_info = get_userdata($uid);
+  		$output = $user_info->display_name;
+  	}
+	if (empty($show))
+		return $output;
+	else
+		echo $output;
+		
+}
 	
 function xpress_list_pings($trackback, $args, $depth) {
@@ -199,4 +213,10 @@
 }
 
+function xpress_is_multi_user(){
+	global $xpress_config;
+	return $xpress_config->is_multi_user;
+}
+
+
 function xpress_substr($str, $start, $length, $trimmarker = '...')
 {
@@ -352,4 +372,6 @@
 function xpress_conditional_title($display = true)
 {
+	$selected_author = xpress_selected_author(false);
+	
 	$output = __('Main', 'xpressme');
 	if (is_category())
@@ -363,8 +385,13 @@
 	if (is_year())
 		$output = sprintf(__('Archive for %s|Yearly archive page', 'xpressme'), get_the_time(__('Y', 'xpressme')));
-	if (is_author())
-		$output = sprintf(__('Archive for the &#8216;%s&#8217; Author', 'xpressme'), get_author_name( get_query_var('author')));
+	if (is_author()){
+		if (empty($selected_author))
+			$output = sprintf(__('Archive for the &#8216;%s&#8217; Author', 'xpressme'), get_author_name( get_query_var('author')));
+	}
 	if (is_search())
 		$output = sprintf(__('Search Results of word &#8216;%s&#8217;', 'xpressme'), get_search_query());
+	
+	if (!empty($selected_author))
+	$output = sprintf(__('Article of %s', 'xpressme'), $selected_author) . ' - ' . $output;
 		
 	if ($display) 
Index: trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 154)
+++ trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php	(revision 155)
@@ -235,3 +235,58 @@
 }
 
+function xpress_set_author_cookie()
+{
+	$author_cookie = get_xpress_dir_name() . "_select_author" ;
+	if(xpress_is_multi_user()){
+		if (empty($_GET)){
+	//		$GLOBALS["wp_xoops_author"] = null;
+			setcookie($author_cookie, 0);
+			$_COOKIE[$author_cookie] = 0;
+			
+		} else {
+			$auth = intval( @$_GET["author"] );
+			if ($auth > 0){
+				setcookie($author_cookie, $auth);
+				$_COOKIE[$author_cookie] = $auth;
+			}
+		}
+	}else{
+	//	$GLOBALS["wp_xoops_author"] = null;
+		setcookie($author_cookie, 0);
+		$_COOKIE[$author_cookie] = 0;
+	}
+}
+
+function xpress_query_filter(&$query)
+{
+	$author_cookie = get_xpress_dir_name() . "_select_author" ;
+	
+	if (strpos($query,'SELECT') !==0)  return $query;
+
+	$select_pattern = "SELECT(.*)post_author(.*)FROM";
+	if (preg_match ( "/".$select_pattern."/i", $query, $select_match ))
+		return $query;
+
+	$query = preg_replace('/\s\s+/', ' ', $query);
+	if (!empty($_COOKIE[$author_cookie])){
+		$pattern = "WHERE(.*)post_type(.*)=(.*)'post'";
+		if ( preg_match ( "/".$pattern."/i", $query, $match ) ){
+			$where_str = "$match[0]";
+			$where_arry = split(' ',$where_str);
+			$post_prefix = '';
+			foreach ($where_arry as $p){
+				if ( preg_match ( "/post_type/", $p, $match3 ) ){
+					$post_prefix = preg_replace("/post_type/", "", $p);
+					break;
+				}
+			}
+			preg_match ( "/post_type(.*)/", $where_str, $p_match );
+			$patern = $p_match[0];
+			$replace = $patern . " AND {$post_prefix}post_author = " . intval($_COOKIE[$author_cookie]) . " ";
+			$query = preg_replace("/$patern/", $replace, $query);
+		}
+	}
+//	xpress_show_sql_quary($query);
+	return $query;
+}
 ?>
