--- activity.module	2008-03-02 21:24:55.000000000 +0800
+++ activity.module	2008-03-03 17:15:00.000000000 +0800
@@ -243,7 +243,7 @@ function activity_get_activity($uids = A
 
   // Build sql limiting query to on filtered fields
   if (!empty($filters) && is_array($filters)) {
-    foreach ($filters as $column => $values) {
+    foreach ($filters as $column => $filter) {
       // Of the possible columns, role is in the at table and all others in the
       // a table. Prefix the column name with the appropriate table.
       if ($column == 'target_role') {
@@ -252,20 +252,22 @@ function activity_get_activity($uids = A
       else {
         $column = "activity.{$column}";
       }
+      foreach ($filter as $criteria => $values) {
       if (is_array($values) && count($values) > 1) {
         foreach ($values as $value) {
           $strings[] = "'%s'";
           $params[] = $value;
         }
-        $wheres[] = $column. ' IN ('. implode(',', $strings). ')';
+          $wheres[] = $column . ($criteria == 'exclude' ? ' NOT IN ' : ' IN ') .'('. implode(',', $strings). ')';
       }
       else {
-        $wheres[] = $column. " = '%s'";
+          $wheres[] = $column . ($criteria == 'exclude' ? ' != ' : ' = ') ."'%s'";
         // $values is a string with the single value.
         $params[] = $values;
       }
     }
   }
+  }
   if (count($wheres) > 0) {
     $where = implode(' AND ', $wheres);
     $where = "WHERE $where";
