From 1753f9376873ed843f12ff6c8fb5f154c2cff989 Mon Sep 17 00:00:00 2001
From: The Great Git Migration <tggm@no-reply.drupal.org>
Date: Fri, 25 Feb 2011 02:10:21 +0000
Subject: [PATCH 1/3] Stripping CVS keywords

---
 similargroups.admin.inc |    1 -
 similargroups.info      |    1 -
 similargroups.module    |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/similargroups.admin.inc b/similargroups.admin.inc
index a23f1dd..2eeadee 100644
--- a/similargroups.admin.inc
+++ b/similargroups.admin.inc
@@ -1,5 +1,4 @@
 <?php
-// $Id$
 
 /**
  * @file Admin file for the OG Similar Groups module
diff --git a/similargroups.info b/similargroups.info
index bd9da03..e91d44e 100644
--- a/similargroups.info
+++ b/similargroups.info
@@ -1,4 +1,3 @@
-; $Id$
 name = OG Similar Groups
 description = Display related groups based on shared membership.
 package = Organic groups
diff --git a/similargroups.module b/similargroups.module
index d7fb64f..2592eea 100644
--- a/similargroups.module
+++ b/similargroups.module
@@ -1,5 +1,4 @@
 <?php
-// $Id$
 
 /**
  * @file This module helps to find similar groups based on shared members.
-- 
1.7.0.4


From d2f2281cc5fbdc49a59df9fe7ada852712a6671b Mon Sep 17 00:00:00 2001
From: Daniel Zhou <danithaca@gmail.com>
Date: Mon, 12 Sep 2011 10:52:27 -0400
Subject: [PATCH 2/3] fixed minor changes

---
 similargroups.module |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/similargroups.module b/similargroups.module
index 4e83421..a1c9203 100644
--- a/similargroups.module
+++ b/similargroups.module
@@ -56,9 +56,9 @@ function similargroups_block($op='list', $delta=0) {
   else if ($op == 'view') {
     $block = array();
     if ($delta == 0) {
-      if (arg(0) == 'node' && is_numeric(arg(1))) {
-        $node_id = arg(1);
-        
+      if ($node = menu_get_object()) {
+        $node_id = $node->nid;
+
         // if the node is an OG group that has users, then display similary groups.
         if (db_result(db_query("SELECT nid FROM {og} WHERE nid=%d", $node_id)) != NULL) {
           $nodes = similargroups_get_similar_groups($node_id);
@@ -80,11 +80,13 @@ function similargroups_block($op='list', $delta=0) {
 function similargroups_run_recommender() { 
   $algorithm = variable_get('similargroups_algorithm', 'classical');
   if ($algorithm == 'classical') {
-    recommender_similarity_classical('similargroups', '{og_uid}', 'nid', 'uid', 'is_active', array(
-      'missing' => 'zero', 'performance' => 'auto'));
-  }
-  else if ($algorithm == 'coocurrence') {
-    recommender_similarity_coocurrences('similargroups', '{og_uid}', 'nid', 'uid', 'is_active');
+    // when pass in the table name, don't do {og_uid} because it'll get expanded twice as {{og_uid}} in recommenderapi.
+    recommender_similarity_classical('similargroups', 'og_uid', 'nid', 'uid', 'is_active', array (
+      'missing' => 'zero',
+      'performance' => 'auto'
+    ));
+  } else if ($algorithm == 'coocurrence') {
+    recommender_similarity_coocurrences('similargroups', 'og_uid', 'nid', 'uid', 'is_active');
   }
 }
 
@@ -98,12 +100,13 @@ function similargroups_get_similar_groups($node_id) {
   
   function test_func($item) {
     // will not accept negative correlated groups.
-    if ($item['score']<=0) return FALSE;
-    
+    if ($item['score'] <= 0)
+      return FALSE;
+
     $node = node_load($item['id']);
     og_load_group($node);
     // only accept non-private and in-directory OG groups
-    if ($node->status==1 && $node->og_private==0 && $node->og_directory==1) {
+    if ($node->status == 1 && $node->og_private == 0 && $node->og_directory == 1) {
       return TRUE;
     } else {
       return FALSE;
-- 
1.7.0.4


From 69aa3bc710d1db25edd02a0f01494823eb1f7d4d Mon Sep 17 00:00:00 2001
From: Andy Carter <andy.carter@futurate.com>
Date: Fri, 13 Jan 2012 14:50:21 +0000
Subject: [PATCH 3/3] Fixed call to l() removing slash before node/

---
 similargroups.module |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/similargroups.module b/similargroups.module
index a1c9203..da33d48 100644
--- a/similargroups.module
+++ b/similargroups.module
@@ -116,9 +116,9 @@ function similargroups_get_similar_groups($node_id) {
   
   function format_node($item) {
     $node = node_load($item['id']);
-    return l($node->title, "/node/{$node->nid}");
+    return l($node->title, "node/{$node->nid}");
   }
   $items = array_map('format_node', $items);
   
   return $items;
-}
\ No newline at end of file
+}
-- 
1.7.0.4

