--- similarterms.module	2007-12-11 07:50:44.000000000 -0500
+++ similarterms.module	2007-12-11 07:55:26.000000000 -0500
@@ -31,6 +31,13 @@
       '#size' => 3,
       '#description' => t('The maximum number of similar items to display'),
     );
+    $form['type'] = array(
+      '#type' => 'radios',
+      '#title' => t('Display nodes of this type'),
+      '#options' => node_get_types('names'),
+      '#default_value' => variable_get('simterms_type_'. $delta, ''),
+      '#description' => t('Only nodes of this type will be displayed in this block.'),
+    );
     return $form; 
     
   }
@@ -59,10 +66,12 @@
  *   integer - node id, leave out to use current page
  * @param $count
  *   integer - how many nodes should we return?
+ * @param $type
+ *   string - type of node to match
  * @return
  *   an array of partial node objects (containing just the parts from the node table)
  */
-function similarterms_list($vid = NULL, $nid = NULL, $count = 5) {
+function similarterms_list($vid = NULL, $nid = NULL, $count = 5, $type = null) {
   if (is_null($nid) && (arg(0) == 'node' && is_numeric(arg(1)))) {
     $nid = arg(1);
   }
@@ -77,6 +86,7 @@
     if (!empty($terms)) {
       //past events
       $pasts = array();
+      $typeclause = $type? sprintf(" AND n.type = '%s' ",db_escape_string($type)): '';
       $result = db_query(
       'SELECT n.nid, n.title, COUNT(n.nid) AS ncount
         FROM {node} n
@@ -84,8 +94,9 @@
         WHERE tn.tid IN (%s)
           AND n.nid != %d
           AND n.status = 1
-          AND n.moderate = 0
-        GROUP BY n.nid, n.title, n.created
+          AND n.moderate = 0'.
+          $typeclause.
+        'GROUP BY n.nid, n.title, n.created
         ORDER BY ncount DESC, n.created DESC
         LIMIT %d'
         , $terms, $nid, $count);
