diff -Nurb tmp/NP_Referrer.php /home/yuxuanwang/yuxuan.org/wang/test/nucleus/plugins/tmp/NP_Referrer.php
--- tmp/NP_Referrer.php	2007-09-14 07:42:23.000000000 -0700
+++ /home/yuxuanwang/yuxuan.org/wang/test/nucleus/plugins/tmp/NP_Referrer.php	2007-09-14 07:48:47.000000000 -0700
@@ -1276,8 +1276,13 @@
 			global $member, $nucleus, $blogid;
 			
 			// only show to admins
-			if (!$member->isLoggedIn() || !$member->isAdmin()) return;
+			if (preg_match("/MD$/", $nucleus['version'])) {
+				$isblogadmin = $member->isBlogAdmin(-1);
+			} else {
+				$isblogadmin = $member->isBlogAdmin($blogid);
+			}
 
+			if (!($member->isLoggedIn() && ($member->isAdmin() || $isblogadmin))) return;
 			array_push(
 				$data['options'],
 				array(
diff -Nurb tmp/referrer/index.php /home/yuxuanwang/yuxuan.org/wang/test/nucleus/plugins/tmp/referrer/index.php
--- tmp/referrer/index.php	2007-09-14 07:42:24.000000000 -0700
+++ /home/yuxuanwang/yuxuan.org/wang/test/nucleus/plugins/tmp/referrer/index.php	2007-09-14 07:46:51.000000000 -0700
@@ -17,7 +17,7 @@
 
 	$oPluginAdmin = new PluginAdmin('Referrer');
 	
-	if (!($member->isLoggedIn() && $member->isAdmin()))
+	if (!$member->isLoggedIn())
 	{
 		$oPluginAdmin->start();
 		echo '<p>' . _ERROR_DISALLOWED . '</p>';
@@ -25,6 +25,12 @@
 		exit;
 	}
 	
+	// Compatiblity with Nucleus < = 2.0
+	if (!function_exists('sql_table')) { function sql_table($name) { return 'nucleus_' . $name; } }
+	
+
+
+	$oPluginAdmin = new PluginAdmin('Referrer');
 	$oPluginAdmin->start();
 	
 	$mTemplate = new Referrer_Template();
@@ -82,11 +88,19 @@
 
 			$res = mysql_query ("
 				UPDATE
-					".sql_table('plugin_referrer_cache')."
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('plugin_referrer')." AS r,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				SET
-					ref_block = 1
+					c.ref_block = 1
 				WHERE
-					ref_id = '".$ref."'
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
+					c.ref_id = '".$ref."'
 			");
 
 			$action = requestVar('next');
@@ -97,11 +111,19 @@
 
 			$res = mysql_query ("
 				UPDATE
-					".sql_table('plugin_referrer_cache')."
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('plugin_referrer')." AS r,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				SET
-					ref_block = 0
+					c.ref_block = 0
 				WHERE
-					ref_id = '".$ref."'
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
+					c.ref_id = '".$ref."'
 			");
 
 			$action = 'blocked';
@@ -111,10 +133,20 @@
 			$ref = intRequestVar('ref');
 
 			$res = mysql_query ("
-				DELETE FROM
-					".sql_table('plugin_referrer_cache')."
+				DELETE
+					c
+				FROM
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('plugin_referrer')." AS r,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
-					ref_id = '".$ref."'
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
+					c.ref_id = '".$ref."'
 			");
 
 			$res = mysql_query ("
@@ -144,9 +176,17 @@
 				SELECT
 					COUNT(*) AS count
 				FROM
-					".sql_table('plugin_referrer_cache')."
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('plugin_referrer')." AS r,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
-					ref_block = 1
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
+					c.ref_block = 1
 			");				
 
 			
@@ -159,11 +199,19 @@
 				SELECT
 					*
 				FROM
-					".sql_table('plugin_referrer_cache')."
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('plugin_referrer')." AS r,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
-					ref_block = 1
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
+					c.ref_block = 1
 				ORDER BY
-					ref_id DESC
+					c.ref_id DESC
 				LIMIT
 					".$start.",".$amount."
 			");				
@@ -201,8 +249,14 @@
 					COUNT(DISTINCT r.ref_id) AS count
 				FROM
 					".sql_table('plugin_referrer')." AS r,
-					".sql_table('plugin_referrer_cache')." AS c
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
 					r.ref_id = c.ref_id AND
 					c.ref_block = 0
 			");	
@@ -221,8 +275,14 @@
 					UNIX_TIMESTAMP(MIN(r.ref_when)) AS timestamp
 				FROM
 					".sql_table('plugin_referrer')." AS r,
-					".sql_table('plugin_referrer_cache')." AS c
+					".sql_table('plugin_referrer_cache')." AS c,
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
 					r.ref_id = c.ref_id AND
 					c.ref_block = 0
 				GROUP BY
@@ -259,10 +319,16 @@
 				SELECT
 					COUNT(*) AS count
 				FROM
+					".sql_table('plugin_referrer_cache')." AS c,
 					".sql_table('plugin_referrer')." AS r,
-					".sql_table('plugin_referrer_cache')." AS c
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
-					r.ref_id = c.ref_id AND
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
 					c.ref_block = 0
 			");	
 			
@@ -278,10 +344,16 @@
 					c.ref_title AS ref_title,
 					UNIX_TIMESTAMP(r.ref_when) AS timestamp
 				FROM
+					".sql_table('plugin_referrer_cache')." AS c,
 					".sql_table('plugin_referrer')." AS r,
-					".sql_table('plugin_referrer_cache')." AS c
+					".sql_table('item')." AS i,
+					".sql_table('team')." AS t
 				WHERE
-					r.ref_id = c.ref_id AND
+					r.ref_item = i.inumber AND
+					i.iblog = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1 AND
+					c.ref_id = r.ref_id AND
 					c.ref_block = 0
 				ORDER BY
 					timestamp desc
@@ -330,8 +402,14 @@
 						COUNT(DISTINCT r.ref_id) AS count
 					FROM
 						".sql_table('plugin_referrer')." AS r,
-						".sql_table('plugin_referrer_cache')." AS c
+						".sql_table('plugin_referrer_cache')." AS c,
+						".sql_table('item')." AS i,
+						".sql_table('team')." AS t
 					WHERE
+						r.ref_item = i.inumber AND
+						i.iblog = t.tblog AND
+						t.tmember = '".$member->id."' AND
+						t.tadmin = 1 AND
 						r.ref_skin = '".addslashes($id)."' AND
 						r.ref_id = c.ref_id AND
 						c.ref_block = 0
@@ -352,8 +430,14 @@
 						UNIX_TIMESTAMP(MIN(r.ref_when)) AS timestamp
 					FROM
 						".sql_table('plugin_referrer')." AS r,
-						".sql_table('plugin_referrer_cache')." AS c
+						".sql_table('plugin_referrer_cache')." AS c,
+						".sql_table('item')." AS i,
+						".sql_table('team')." AS t
 					WHERE
+						r.ref_item = i.inumber AND
+						i.iblog = t.tblog AND
+						t.tmember = '".$member->id."' AND
+						t.tadmin = 1 AND
 						r.ref_skin = '".addslashes($id)."' AND
 						r.ref_id = c.ref_id AND
 						c.ref_block = 0
@@ -407,8 +491,14 @@
 							COUNT(DISTINCT r.ref_id) AS count
 						FROM
 							".sql_table('plugin_referrer')." AS r,
-							".sql_table('plugin_referrer_cache')." AS c
+							".sql_table('plugin_referrer_cache')." AS c,
+							".sql_table('item')." AS i,
+							".sql_table('team')." AS t
 						WHERE
+							r.ref_item = i.inumber AND
+							i.iblog = t.tblog AND
+							t.tmember = '".$member->id."' AND
+							t.tadmin = 1 AND
 							r.ref_item = '".$id."' AND
 							r.ref_skin = 'item' AND
 							r.ref_id = c.ref_id AND
@@ -429,8 +519,14 @@
 					        UNIX_TIMESTAMP(MIN(r.ref_when)) AS timestamp
 						FROM
 							".sql_table('plugin_referrer')." AS r,
-							".sql_table('plugin_referrer_cache')." AS c
+							".sql_table('plugin_referrer_cache')." AS c,
+							".sql_table('item')." AS i,
+							".sql_table('team')." AS t
 						WHERE
+							r.ref_item = i.inumber AND
+							i.iblog = t.tblog AND
+							t.tmember = '".$member->id."' AND
+							t.tadmin = 1 AND
 							r.ref_item = '".$id."' AND
 							r.ref_skin = 'item' AND
 							r.ref_id = c.ref_id AND
@@ -469,11 +565,16 @@
 		case 'index':
 			$bres = mysql_query ("
 				SELECT
-					bnumber AS bnumber,
-					bname AS bname,
-					burl AS burl
-				FROM
-					".sql_table('blog')."
+					b.bnumber AS bnumber,
+					b.bname AS bname,
+					b.burl AS burl
+				FROM
+					".sql_table('blog')." AS b,
+					".sql_table('team')." AS t
+				WHERE
+					b.bnumber = t.tblog AND
+					t.tmember = '".$member->id."' AND
+					t.tadmin = 1
 				ORDER BY
 					bname
 			");
