--- og_user_roles.module.5.x-2.3.orig	2007-09-05 11:13:42.000000000 -0700
+++ og_user_roles.module	2007-09-05 11:14:25.000000000 -0700
@@ -1,5 +1,5 @@
 <?php
-// $Id: og_user_roles.module,v 1.1.2.7 2007/08/29 04:11:29 somebodysysop Exp $
+// $Id: og_user_roles.module,v 1.1.2.3 2007/07/08 19:50:44 somebodysysop Exp $
 
 /**
  * @file
@@ -167,7 +167,7 @@ function og_user_roles_admin_settings() 
     '#type' => 'checkbox',
     '#title' => t('Integrate TAC and OG Access Control?'),
     '#default_value' => variable_get('og_user_roles_tac_og_value', 0),
-    '#description' => t('Do you have Taxonomy Access installed and do you wish to make its access control work with Organic Groups?  Details here: http://groups.drupal.org/node/3700'),
+    '#description' => t('Do you have Taxonomy Access installed and do you wish to make its access control work with Organic Groups?  Details here: ' . l("How to Make OG and TAC Work Together: Step 2", "http://groups.drupal.org/node/3700")),
   );
 
   if (module_exists('og_subgroups')) {
@@ -213,7 +213,7 @@ function og_user_roles_admin_settings() 
     '#type' => 'checkbox',
     '#title' => t('Output debug data to og_user_test table?'),
     '#default_value' => variable_get('og_user_roles_test_default', 0),
-    '#description' => t('Every time user_access() is called, it will call og_user_all_roles() which adds group roles to $user->roles.  Do you wish to see the output from this function? (Note that this feature is for testing/debug purposes, and could create a very large output file.  This feature also requires that the table og_user_test already exist. Details here: http://drupal.org/node/164038)'),
+    '#description' => t('Every time user_access() is called, it will call og_user_all_roles() which adds group roles to $user->roles.  Do you wish to see the output from this function? (Note that this feature is for testing/debug purposes, and could create a very large output file.  This feature also requires that the table og_user_test already exist. Details here: ' . l("OG User Roles: Test", "http://drupal.org/node/164038")),
   );
 
   return system_settings_form($form);
@@ -1057,6 +1057,15 @@ function og_user_roles_all_roles($user) 
       $gid = og_user_roles_getgid($nid, $uid);
     }
 
+    //                           0    1    2
+    // http://www.mysite.com/comment/delete/14
+    if (arg(0) == 'comment' && is_numeric(arg(2)) && arg(1) == 'delete') {
+      $location = 31;
+      $comment = _comment_load(arg(2));
+      $nid = $comment->nid;
+      $gid = og_user_roles_getgid($nid, $uid);
+    }
+
     //                           0      1    2
     // http://www.mysite.com/comment/reply/128#comment_form
     if (arg(0) == 'comment' && arg(1) == 'reply') {
@@ -1814,7 +1823,10 @@ function og_user_roles_node_access_join_
 	$return .= 'left outer join {og_users_roles} ogr on ogr.rid = '. $node_access_alias .'.gid '; // uses og_users_roles rid
 	$return .= 'left outer join {og_uid} ogu on ogu.nid = '. $node_access_alias .'.nid '; // added og_uid table to the mix
 	$return .= 'left outer join {nodefamily} nof on nof.child_nid = '. $node_access_alias .'.nid '; // added nodefamily table to the mix
-	$return .= 'left outer join {usernode} un on nof.parent_nid = un.nid '; // added usernode table to the mix
+    // http://drupal.org/node/173194
+    if (module_exists('usernode')) {
+      $return .= 'left outer join {usernode} un on nof.parent_nid = un.nid '; // added usernode table to the mix
+    }
     if (module_exists('acl')) {
       $return .= 'LEFT OUTER JOIN {acl_node} an ON an.nid = '. $node_access_alias .'.nid ';
       $return .= 'LEFT OUTER JOIN {acl_user} aclu ON aclu.acl_id = an.acl_id ';
@@ -1906,7 +1918,10 @@ function og_user_roles_node_access_where
 	$sql .= " OR (ogm.nid > 0 and (" . $node_access_alias . ".nid in ('".implode("','",$gids)."')) or ogm.directory = 1 ) "; // this allows us to see group nodes including those which allow directory listing
 	$sql .= " OR (" . $node_access_alias . ".realm = 'og_public' AND  " . $node_access_alias . ".gid = 0) ";
 	$sql .= " OR (ogr.uid = " . $uid . " AND ta.rid = ogr.rid AND ogan.group_nid = ogr.gid AND ta.grant_list = true) "; // original mod
-	$sql .= " OR (nof.child_nid = " . $node_access_alias . ".nid AND " . $node_access_alias . ".realm = 'term_access' AND un.uid = ". $uid ." AND " . $node_access_alias . ".grant_view = 1) "; // To list only your own uprofile node
+    // http://drupal.org/node/173194
+    if (module_exists('usernode')) {
+      $sql .= " OR (nof.child_nid = " . $node_access_alias . ".nid AND " . $node_access_alias . ".realm = 'term_access' AND un.uid = ". $uid ." AND " . $node_access_alias . ".grant_view = 1) "; // To list only your own uprofile node
+    }
 	$sql .= " OR (nof.child_nid = " . $node_access_alias . ".nid 
 				AND " . $node_access_alias . ".realm = 'term_access' 
 				AND ta.rid in ('".implode("','",$rids)."') 
