? .svn
? similarbyterms-revisions-408262-1.patch
? similarterms-new_hook-413184-1.patch
? po/.svn
? translations/.svn
Index: similarterms.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/similarterms/similarterms.module,v
retrieving revision 1.23
diff -u -p -r1.23 similarterms.module
--- similarterms.module	26 Jan 2009 22:15:01 -0000	1.23
+++ similarterms.module	25 Mar 2009 10:58:39 -0000
@@ -177,7 +177,7 @@ function similarterms_list($vocid = 0, $
 
       $sql = 'SELECT n.nid, n.title, COUNT(n.nid) AS ncount ';
       $sql .= 'FROM {node} n ';
-      $sql .= 'INNER JOIN {term_node} tn ON n.nid = tn.nid ';
+      $sql .= 'INNER JOIN {term_node} tn ON n.vid = tn.vid ';
 
       $sql .= 'WHERE tn.tid IN (';
       $number_of_terms = count($terms);
@@ -241,6 +241,11 @@ function similarterms_list($vocid = 0, $
       while ($r = db_fetch_object($result)) {
         $nodes[] = node_load($r->nid);
       }
+
+      // Allow modules to alter the list of nodes by implementing a hook.
+      // TODO: Pass by reference the $nodes array rather than returning them.
+      $nodes = module_invoke_all('similarterms_alter', $node_obj, $nodes);
+
       if ($cache_lifetime) {
         cache_set($cid, $nodes, 'cache_similarterms', time() + $cache_lifetime);
       }
@@ -252,14 +257,14 @@ function similarterms_list($vocid = 0, $
 /**
  * Implementation of hook_flush_caches().
  */
-function  similarterms_flush_caches() {
+function similarterms_flush_caches() {
   return array('cache_similarterms');
 }
 
 /**
  * Implementation of hook_menu().
  */
-function  similarterms_menu() {
+function similarterms_menu() {
   // Admin settings for the site.
   $items['admin/settings/similarterms'] = array(
     'title' => 'Similar By Terms',
@@ -285,4 +290,3 @@ function similarterms_theme() {
     ),
   );
 }
-
