Index: og_user_roles.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_user_roles/og_user_roles.info,v
retrieving revision 1.3
diff -u -p -r1.3 og_user_roles.info
--- og_user_roles.info	23 May 2009 02:40:41 -0000	1.3
+++ og_user_roles.info	23 May 2009 03:26:07 -0000
@@ -1,8 +1,7 @@
 ; $Id: og_user_roles.info,v 1.3 2009/05/23 02:40:41 sun Exp $
 name = Organic groups user roles
-description = "Allows group administrators to add members into Drupal system roles which are restricted to the group. (NOT same as OG Roles module.)"
+description = Dynamically assign user roles to members of organic groups.
 dependencies[] = og
-package = "Organic groups"
+package = Organic groups
 core = 6.x
 php = 4.3.9 
-
Index: og_user_roles.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_user_roles/og_user_roles.install,v
retrieving revision 1.3
diff -u -p -r1.3 og_user_roles.install
--- og_user_roles.install	23 May 2009 03:12:57 -0000	1.3
+++ og_user_roles.install	23 May 2009 03:29:24 -0000
@@ -1,6 +1,9 @@
 <?php
 // $Id: og_user_roles.install,v 1.3 2009/05/23 03:12:57 sun Exp $
 
+/**
+ * Implementation of hook_install().
+ */
 function og_user_roles_install() {
   drupal_install_schema('og_user_roles');
 }
@@ -15,6 +18,9 @@ function og_user_roles_uninstall() {
   db_query("DELETE FROM {variable} WHERE name LIKE 'og_user_roles_%%'");
 }
 
+/**
+ * Implementation of hook_schema().
+ */
 function og_user_roles_schema() {
   $schema['og_users_roles'] = array(
     'fields' => array(
@@ -30,29 +36,26 @@ function og_user_roles_schema() {
     'description' => t('Table to record multinode access configurations for modules.'),
     'fields' => array(
       'realm' => array(
-        'type' => 'varchar',
-        'length' => 30,
+        'type' => 'varchar', 'length' => 30,
         'description' => t('Realm.'),
       ),
       'groupname' => array(
-        'type' => 'varchar',
-        'length' => 10,
+        'type' => 'varchar', 'length' => 10,
         'description' => t('Group tag.'),
       ),
       'logic' => array(
-        'type' => 'varchar',
-        'length' => 5,
+        'type' => 'varchar', 'length' => 5,
         'description' => t('Logic to use.'),
       ),
       'weight' => array(
-        'type' => 'varchar',
-        'length' => 5,
+        'type' => 'varchar', 'length' => 5,
         'description' => t('Order in which this module is to be processed.'),
       ),
-      'checkstatus' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+      'checkstatus' => array(
+        'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,
+      ),
       'module' => array(
-        'type' => 'varchar',
-        'length' => 60,
+        'type' => 'varchar', 'length' => 60,
         'description' => t('Name of module.'),
       ),
     ),
@@ -62,68 +65,55 @@ function og_user_roles_schema() {
     'description' => t('Test table to record group context when user object is loaded.'),
     'fields' => array(
       'testDate' => array(
-        'type' => 'varchar',
-        'length' => 25,
+        'type' => 'varchar', 'length' => 25,
         'description' => t('Date recorded.'),
       ),
       'testUser' => array(
-        'type' => 'varchar',
-        'length' => 10,
+        'type' => 'varchar', 'length' => 10,
         'description' => t('UID of the user making the entry.'),
       ),
       'testUserName' => array(
-        'type' => 'varchar',
-        'length' => 40,
+        'type' => 'varchar', 'length' => 40,
         'description' => t('Name of the user making the entry.'),
       ),
       'testGroup' => array(
-        'type' => 'varchar',
-        'length' => 10,
+        'type' => 'varchar', 'length' => 10,
         'description' => t('GID of the group OG User Roles has calculated this page belongs to.'),
       ),
       'testFunction' => array(
-        'type' => 'varchar',
-        'length' => 60,
+        'type' => 'varchar', 'length' => 60,
         'description' => t('The function these values are reported from.'),
       ),
       'testSubFunction' => array(
-        'type' => 'varchar',
-        'length' => 80,
+        'type' => 'varchar', 'length' => 80,
         'description' => t('Location (if any) within code that returns the the GID.'),
       ),
       'testString' => array(
-        'type' => 'varchar',
-        'length' => 60,
+        'type' => 'varchar', 'length' => 60,
         'description' => t('This is the GID as returned by the group context: og_get_group_context().'),
       ),
       'testStatus' => array(
-        'type' => 'varchar',
-        'length' => 10,
+        'type' => 'varchar', 'length' => 10,
         'description' => t('Returning nothing right now.'),
       ),
       'testURI' => array(
-        'type' => 'varchar',
-        'length' => 200,
+        'type' => 'varchar', 'length' => 200,
         'description' => t('The value returned by: $uri_request_id = request_uri() as well as referring url in parenthesis.'),
       ),
       'testAArg0' => array(
-        'type' => 'varchar',
-        'length' => 40,
+        'type' => 'varchar', 'length' => 40,
         'description' => t('arg(0).'),
       ),
       'testAArg1' => array(
-        'type' => 'varchar',
-        'length' => 40,
+        'type' => 'varchar', 'length' => 40,
         'description' => t('arg(1).'),
       ),
       'testAArg2' => array(
-        'type' => 'varchar',
-        'length' => 40,
+        'type' => 'varchar', 'length' => 40,
         'description' => t('arg(2).'),
       ),
       'testAArg3' => array(
-        'type' => 'varchar',
-        'length' => 40,
+        'type' => 'varchar', 'length' => 40,
         'description' => t('arg(3).'),
       ),
       'testPerm' => array(
Index: og_user_roles.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_user_roles/og_user_roles.module,v
retrieving revision 1.3
diff -u -p -r1.3 og_user_roles.module
--- og_user_roles.module	23 May 2009 03:12:57 -0000	1.3
+++ og_user_roles.module	23 May 2009 04:10:19 -0000
@@ -3,7 +3,7 @@
 
 /**
  * @file
- * Allows group administrators to add members into Drupal system roles limited by group.
+ * Dynamically assign user roles to members of organic groups.
  */
 
 /**
@@ -21,18 +21,34 @@ function og_user_roles_help($path, $arg)
  *
  * Modification as per: http://drupal.org/node/192747
  * Added 'administer og_user_roles'
- *
  */
 function og_user_roles_perm() {
-  return array('administer og_user_roles', 'configure member roles', 'create og_subgroups', 'manage registration codes', 'use registration codes', 'no oguseredit', 'configure restricted member roles', 'ogur perm 01', 'ogur perm 02', 'ogur perm 03', 'ogur perm 04', 'ogur perm 05', 'ogur perm 06', 'ogur perm 07', 'ogur perm 08', 'ogur perm 09', 'ogur perm 10', 'auto assign group roles');
+  return array(
+    'administer og_user_roles',
+    'configure member roles',
+    'create og_subgroups',
+    'manage registration codes',
+    'use registration codes',
+    'no oguseredit',
+    'configure restricted member roles',
+    'ogur perm 01',
+    'ogur perm 02',
+    'ogur perm 03',
+    'ogur perm 04',
+    'ogur perm 05',
+    'ogur perm 06',
+    'ogur perm 07',
+    'ogur perm 08',
+    'ogur perm 09',
+    'ogur perm 10',
+    'auto assign group roles',
+  );
 }
 
 /**
  * Implementation of hook_access().
  */
 function og_user_roles_access($op, $node, $account) {
-  global $user;
-
   if ($op == 'create') {
     return user_access('create og_subgroups');
   }
@@ -42,16 +58,14 @@ function og_user_roles_access($op, $node
  * Implementation of hook_settings().
  */
 function og_user_roles_admin_settings() {
-
-  $types = array();
-
-  // Get list of all og-enabled node types
+  // Get list of all og-enabled node types.
   $group_types = og_get_types('group');
+  $types = array();
   foreach ($group_types as $type) {
     $types[$type] = node_get_types('name', $type);
   }
 
-  // Get list of roles, not counting authenticated and anonymous user
+  // Get list of roles, not counting authenticated and anonymous user.
   $all_roles = user_roles();
   foreach ($all_roles as $rid => $role) {
     if ($rid > 2) {
@@ -68,57 +82,57 @@ function og_user_roles_admin_settings() 
     return $form;
   }
 
-  // Create a fieldset for each group type containing role selections
+  // Create a fieldset for each group type containing role selections.
   foreach ($types as $type => $name) {
-    $form["og_user_roles_$type"] = array(
+    $form['og_user_roles_$type'] = array(
       '#type' => 'fieldset',
       '#title' => t('%type_name role options', array('%type_name' => $name)),
     );
-    $form["og_user_roles_$type"]["og_user_roles_roles_$type"] = array(
+    $form['og_user_roles_$type']['og_user_roles_roles_$type'] = array(
       '#type' => 'checkboxes',
       '#title' => t('Assignable roles'),
       '#options' => $roles,
-      '#default_value' => variable_get("og_user_roles_roles_$type", array()),
+      '#default_value' => variable_get('og_user_roles_roles_$type', array()),
     );
-    $form["og_user_roles_$type"]['og_user_roles_default_role'] = array(
+    $form['og_user_roles_$type']['og_user_roles_default_role'] = array(
       '#type' => 'fieldset',
       '#title' => t('Default group role for users who join groups of this type: <strong>%type_name</strong>.', array('%type_name' => $name)),
       '#description' => t('Allows you to select a group role to automatically assign to users who join any group of type <b>%type_name</b> on your site.', array('%type_name' => $name)),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
     );
-    $form["og_user_roles_$type"]['og_user_roles_default_role']["ogur_assign_typegrouprole_$type"] = array(
+    $form['og_user_roles_$type']['og_user_roles_default_role']['ogur_assign_typegrouprole_$type'] = array(
       '#type' => 'checkbox',
       '#title' => t('<strong>Set default basic group (group limited) role for users who join groups of this type: %type_name?</strong>', array('%type_name' => $name)),
-      '#default_value' => variable_get("ogur_assign_typegrouprole_$type", 0),
+      '#default_value' => variable_get('ogur_assign_typegrouprole_$type', 0),
       '#description' => t('Do you wish to automatically assign a specific "basic group role" to <strong>every new group subscriber</strong> at the time he subscribes to a group of this type: %type_name? The role is limited to the group that he is subscribed to. This role assignment can be removed by the groups\' admins', array('%type_name' => $name)),
     );
-    $form["og_user_roles_$type"]['og_user_roles_default_role']["ogur_typegrouprole_value_$type"] = array(
+    $form['og_user_roles_$type']['og_user_roles_default_role']['ogur_typegrouprole_value_$type'] = array(
       '#type' => 'select',
       '#title' => t('Role to use as a group type %type_name role', array('%type_name' => $name)),
       '#options' => $roles,
-      '#default_value' => variable_get("ogur_typegrouprole_value_$type", 0),
+      '#default_value' => variable_get('ogur_typegrouprole_value_$type', 0),
       '#description' => t('Select the role you wish to use as the "group role" for every new groupmember to groups of this type: %type_name.', array('%type_name' => $name)),
     );
 
-    $form["og_user_roles_$type"]['og_user_roles_founder'] = array(
+    $form['og_user_roles_$type']['og_user_roles_founder'] = array(
       '#type' => 'fieldset',
       '#title' => t('Default Founder Role for users who create groups of type: <strong>%type_name</strong>.', array('%type_name' => $name)),
       '#description' => t('Allows you to select a group role to automatically assign to users who create groups of type <b>%type_name</b> on your site. The role is specific to the group(s) this user creates.  That is, the user will only have the privileges of the role in the group that he creates.', array('%type_name' => $name)),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
     );
-    $form["og_user_roles_$type"]['og_user_roles_founder']["ogur_assign_founder_$type"] = array(
+    $form['og_user_roles_$type']['og_user_roles_founder']['ogur_assign_founder_$type'] = array(
       '#type' => 'checkbox',
       '#title' => t('Set default group founder (group limited) role for users who create groups of type: <b>%type_name</b>?', array('%type_name' => $name)),
-      '#default_value' => variable_get("ogur_assign_founder_$type", 0),
+      '#default_value' => variable_get('ogur_assign_founder_$type', 0),
       '#description' => t('Do you wish to automatically assign a user (e.g. "founder") who creates a group of type <b>%type_name</b> to a group specific role that is limited to the group that he creates?', array('%type_name' => $name)),
     );
-    $form["og_user_roles_$type"]['og_user_roles_founder']["ogur_founder_value_$type"] = array(
+    $form['og_user_roles_$type']['og_user_roles_founder']['ogur_founder_value_$type'] = array(
       '#type' => 'select',
       '#title' => t('Role to use as founder role for group type <b>%type_name</b>: ', array('%type_name' => $name)),
       '#options' => $roles,
-      '#default_value' => variable_get("ogur_founder_value_$type", 0),
+      '#default_value' => variable_get('ogur_founder_value_$type', 0),
       '#description' => t('Select the role you wish to use as the "founder" role for group type <b>%type_name</b>.', array('%type_name' => $name)),
     );
   }
@@ -136,19 +150,19 @@ function og_user_roles_admin_settings() 
     '#default_value' => variable_get('og_user_roles_permissions', ''),
     '#cols' => 30,
     '#rows' => 4,
-    '#description' => t('Users with the <strong>configure restricted member roles</strong> permission must have a role which contains the permissions required to assign specific roles. There should be a permission for each role that can be assigned by this user. You must define that relationship here. Every permission goes on a separate line.  Each line consists of the permission itself and the role to which the permission grants the user the right to assign to another user. Each permission / role combination is separated by the <b>|</b> character.  <p>Structure your entries like this:
-        <p>
-        <strong>
-          permission|role<br />
-        </strong>
-        <p>For example:
-		<p>
-        <strong>
-          assign GroupMember role|GroupMember<br />
-          assign GroupAdmin role|GroupAdmin<br />
-        </strong>
-        </p>
-        <p>Each record is on a separate line. Each line contains the permission required to be able to assign a role, and the assignable role that permission allows. Each permission and role on a line is separated by a | .'),
+    '#description' => t('Users with the <strong>configure restricted member roles</strong> permission must have a role which contains the permissions required to assign specific roles. There should be a permission for each role that can be assigned by this user. You must define that relationship here. Every permission goes on a separate line.  Each line consists of the permission itself and the role to which the permission grants the user the right to assign to another user. Each permission / role combination is separated by the <strong>|</strong> character. Structure your entries like this:
+<code>
+permission|role
+</code>
+<br />
+For example:
+<br />
+<code>
+assign GroupMember role|GroupMember<br />
+assign GroupAdmin role|GroupAdmin<br />
+</code>
+<br />
+Each record is on a separate line. Each line contains the permission required to be able to assign a role, and the assignable role that permission allows. Each permission and role on a line is separated by a | .'),
   );
 
   $form['og_user_roles_regcode_gid_default'] = array(
@@ -186,7 +200,7 @@ function og_user_roles_admin_settings() 
     '#title' => t('Allow group admins to approve new signups.'),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
-    '#description' => t('<strong>If user registration to your site requires administrator approval</strong> and you allow users to subscribe to groups at registration, then you can optionally allow the administrator(s) of the group(s) to which the user is subscribing to approve the signup request.  This will require that the administrator of each group that you wish to give this privilege have a role which includes the <strong>administer users</strong> permission. (Note that this feature requires ' . l("mimemail.module", "http://www.drupal.org/project/mimemail") . ' to be installed)'),
+    '#description' => t('<strong>If user registration to your site requires administrator approval</strong> and you allow users to subscribe to groups at registration, then you can optionally allow the administrator(s) of the group(s) to which the user is subscribing to approve the signup request.  This will require that the administrator of each group that you wish to give this privilege have a role which includes the <strong>administer users</strong> permission. (Note that this feature requires ' . l('mimemail.module', 'http://www.drupal.org/project/mimemail') . ' to be installed)'),
   );
   $form['og_user_roles_approval']['og_user_roles_approval_default'] = array(
     '#type' => 'checkbox',
@@ -281,7 +295,7 @@ function og_user_roles_admin_settings() 
     '#type' => 'checkbox',
     '#title' => t('Send email notification to group admin when new subscriber is added to group?'),
     '#default_value' => variable_get('og_user_roles_notify_default', 0),
-    '#description' => t('Do you wish to automatically send an email notification to the group administrator when a new subscriber is added to a group? (Note that this feature requires ' . l("mimemail.module", "http://www.drupal.org/project/mimemail") . ' to be installed)'),
+    '#description' => t('Do you wish to automatically send an email notification to the group administrator when a new subscriber is added to a group? (Note that this feature requires ' . l('mimemail.module', 'http://www.drupal.org/project/mimemail') . ' to be installed)'),
   );
 
   $form['og_user_roles_all_groups'] = array(
@@ -307,9 +321,9 @@ function og_user_roles_admin_settings() 
   );
 
   // Check to see if taxonomy_access is installed.
-  $taxonomy_access = "not installed";
+  $taxonomy_access = 'not installed';
   $disabled = 1;
-  if (module_exists("taxonomy_access")) {
+  if (module_exists('taxonomy_access')) {
     $disabled = 0;
     $taxonomy_access = 'installed';
   }
@@ -318,7 +332,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?  Note that this feature requires that you install the ' . l("Taxonomy Access Control Module", "http://www.drupal.org/project/taxonomy_access") . '.  The <strong>taxonomy_access.module</strong> is currently <strong>' . $taxonomy_access . '</strong>.  Details here: ' . l("How to Make OG and TAC Work Together: Step 2", "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?  Note that this feature requires that you install the ' . l('Taxonomy Access Control Module', 'http://www.drupal.org/project/taxonomy_access') . '.  The <strong>taxonomy_access.module</strong> is currently <strong>' . $taxonomy_access . '</strong>.  Details here: ' . l('How to Make OG and TAC Work Together: Step 2', 'http://groups.drupal.org/node/3700')),
     '#disabled' => $disabled,
   );
 
@@ -352,7 +366,7 @@ function og_user_roles_admin_settings() 
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-  $description = 'Do you wish to automatically clear the cache_menu item and reset the user_access() cached permissions for this user?  See ' . l("OG User Roles and File Upload", "http://drupal.org/node/166566") . ' and ' . l("OG User Roles: Clearing the Cache", "http://drupal.org/node/177948") . ' for details.  Please note that this setting creates a heavy overload as permissions must be re-created on each page load.  Use this setting only if absolutely necessary.';
+  $description = 'Do you wish to automatically clear the cache_menu item and reset the user_access() cached permissions for this user?  See ' . l('OG User Roles and File Upload', 'http://drupal.org/node/166566') . ' and ' . l('OG User Roles: Clearing the Cache', 'http://drupal.org/node/177948') . ' for details.  Please note that this setting creates a heavy overload as permissions must be re-created on each page load.  Use this setting only if absolutely necessary.';
   $form['og_user_roles_clear_cache']['og_user_roles_clear_cache_value'] = array(
     '#type' => 'checkbox',
     '#title' => t('Clear the user_access() and cache_menu caches for user?'),
@@ -370,7 +384,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: ' . l("OG User Roles: Test", "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')),
   );
 
   $form['og_user_roles_menu_options'] = array(
@@ -427,7 +441,7 @@ function og_user_roles_admin_settings() 
 }
 
 /**
- * Implementation of hook_theme()
+ * Implementation of hook_theme().
  */
 function og_user_roles_theme() {
   return array(
@@ -442,13 +456,9 @@ function og_user_roles_theme() {
  */
 function og_user_roles_multinode() {
   global $user;
-  if (isset($uid)) {
-    $account = user_load(array('uid' => $uid));
-  }
-  else {
-    $account = $user;
-    $uid = $user->uid;
-  }
+
+  $account = $user;
+  $uid = $user->uid;
 
   // Get whatever is stored in multinode table.
   $existing = array();
@@ -478,36 +488,62 @@ function og_user_roles_multinode() {
 
   $form = array('#tree' => TRUE);
   foreach ($rules as $realm) {
-    $form[$realm]['checkbox'] = array('#type' => 'checkbox', '#default_value' => (isset($existing[$realm]->realm) ? 1 : 0));
-    $form[$realm]['realm'] = array('#type' => 'textfield', '#size' => 25, '#disabled' => TRUE, '#value' => check_plain($realm), '#default_value' => $realm);
-    $form[$realm]['group'] = array('#type' => 'textfield', '#size' => 5, '#default_value' => (isset($existing[$realm]->groupname) ? $existing[$realm]->groupname : ''));
-    $form[$realm]['logic'] = array('#type' => 'select', '#default_value' => (isset($existing[$realm]->logic) ? $existing[$realm]->logic : 'AND'), '#options' => array('AND' => 'AND', 'OR' => 'OR'));
-    $form[$realm]['weight'] = array('#type' => 'select', '#default_value' => (isset($existing[$realm]->weight) ? $existing[$realm]->weight : '0'), '#options' => array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9'));
-    $form[$realm]['check'] = array('#type' => 'select', '#default_value' => (isset($existing[$realm]->checkstatus) ? $existing[$realm]->checkstatus : '0'), '#options' => array('0' => '0', '1' => '1'));
+    $form[$realm]['checkbox'] = array(
+      '#type' => 'checkbox',
+      '#default_value' => (isset($existing[$realm]->realm) ? 1 : 0),
+    );
+    $form[$realm]['realm'] = array(
+      '#type' => 'textfield', '#size' => 25,
+      '#disabled' => TRUE,
+      '#value' => check_plain($realm),
+      '#default_value' => $realm);
+    $form[$realm]['group'] = array(
+      '#type' => 'textfield',
+      '#size' => 5,
+      '#default_value' => (isset($existing[$realm]->groupname) ? $existing[$realm]->groupname : ''),
+    );
+    $form[$realm]['logic'] = array(
+      '#type' => 'select',
+      '#default_value' => (isset($existing[$realm]->logic) ? $existing[$realm]->logic : 'AND'),
+      '#options' => array('AND' => 'AND', 'OR' => 'OR'),
+    );
+    $form[$realm]['weight'] = array(
+      '#type' => 'select',
+      '#default_value' => (isset($existing[$realm]->weight) ? $existing[$realm]->weight : '0'),
+      '#options' => drupal_map_assoc(range(0, 9)),
+    );
+    $form[$realm]['check'] = array(
+      '#type' => 'checkbox',
+      '#default_value' => (isset($existing[$realm]->checkstatus) ? $existing[$realm]->checkstatus : '0'),
+    );
   }
 
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
-
   $form['#theme'] = 'og_user_roles_multinode';
 
   return $form;
 }
 
 /**
- * Theme function to render the table for the og_user_roles_multinode
- * Multinode access UI
+ * Render a table for the og_user_roles_multinode.
+ *
+ * Multinode access UI.
  */
 function theme_og_user_roles_multinode($form) {
-  $output .= "\n<div id=\"og-roles-multinode-form\">\n";
-  $output .= '<div id="desc">' . t('Here you can configure multinode access.  You can only modify values here if TAC/OG Integration is ON. If you turn TAC/OG Integration ON, then later wish to turn it off, you must first UNCHECK all items here (otherwise, multinode access will continue).') . "</div>\n";
+  $output .= '<div id="og-roles-multinode-form">';
+  $output .= '<div id="desc">' . t('Here you can configure multinode access.  You can only modify values here if TAC/OG Integration is ON. If you turn TAC/OG Integration ON, then later wish to turn it off, you must first UNCHECK all items here (otherwise, multinode access will continue).') . '</div>';
+
   $header = array(t(''), t('Realm'), t('Group'), t('Logic'), t('Weight'), t('Check'));
   $rows = array();
-
   foreach (element_children($form) as $i) {
     $block = &$form[$i];
-    $rows[] = array(drupal_render($block['checkbox']), drupal_render($block['realm']),
-      drupal_render($block['group']), drupal_render($block['logic']),
-      drupal_render($block['weight']), drupal_render($block['check']),
+    $rows[] = array(
+      drupal_render($block['checkbox']),
+      drupal_render($block['realm']),
+      drupal_render($block['group']),
+      drupal_render($block['logic']),
+      drupal_render($block['weight']),
+      drupal_render($block['check']),
     );
   }
 
@@ -519,10 +555,10 @@ function theme_og_user_roles_multinode($
     $output .= drupal_render($form['submit']);
   }
   else {
-    $output .= '<div id="comments">' . t('<strong>TAC/OG Integration is OFF</strong>.') . "</div>\n";
+    $output .= '<div id="comments">' . t('<strong>TAC/OG Integration is OFF</strong>.') . '</div>';
   }
 
-  $output .= "</div>\n";
+  $output .= '</div>';
   $output .= drupal_render($form);
   return $output;
 }
@@ -540,6 +576,7 @@ function og_user_roles_multinode_submit(
       db_query("INSERT INTO {multinode_access} (realm, groupname, logic, weight, checkstatus) VALUES ('%s','%s','%s','%s',%d)", $block['realm'], $block['group'], $block['logic'], $block['weight'], $block['check']);
     }
   }
+
   drupal_set_message(t('The multinode access settings have been updated.'));
   cache_clear_all();
 }
@@ -550,8 +587,6 @@ function og_user_roles_multinode_submit(
 function og_user_roles_menu() {
   global $user;
 
-  $items = array();
-
   $items['admin/og/og_user_roles'] = array(
     'title' => 'Organic groups user roles',
     'description' => 'Allows group administrators to add members into group roles.   Also edit multinode access configuration.',
@@ -624,9 +659,7 @@ function og_user_roles_menu() {
     'weight' => 10,
     'type' => MENU_LOCAL_TASK,
   );
-  //
   // Not sure if putting $user->uid in array will work here
-  //
   $items['oglogo'] = array(
     'title' => 'Group Logo',
     'page callback' => 'og_user_roles_oglogo',
@@ -694,7 +727,6 @@ function og_user_roles_menu() {
  * Menu callback; displays members and role selection
  */
 function og_user_roles_page($gid) {
-
   $output = '';
   $node = node_load($gid);
   // Get roles associated with this group. We rebuild the associative
@@ -761,8 +793,6 @@ function og_user_roles_restricted_page($
 function og_user_roles_modr8_page($nid) {
   require_once drupal_get_path('module', 'modr8') . '/modr8_admin.inc';
 
-  //  $count_sql = db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE n.status = 1 AND n.moderate = 1 AND n.nid = '.$nid);
-  //  $page_sql = db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.status = 1 AND n.moderate = 1 AND n.nid = '.$nid.' ORDER BY n.changed DESC');
   $is_published = '';
   if (!user_access('administer nodes')) {
     // Users who don't have the 'administer nodes' permission can only see published nodes.
@@ -792,7 +822,6 @@ function og_user_roles_page_form($form_v
   // Make sure form array isn't flattened
   $form['user_roles'] = array('#tree' => TRUE);
   while ($account = db_fetch_object($result)) {
-
     $form['user_roles']['users'][$account->uid] = array(
       '#type' => 'value',
       '#value' => $account->uid,
@@ -801,7 +830,6 @@ function og_user_roles_page_form($form_v
     $title = theme('username', $account) . ' (' . l(t('unsubscribe'), "og/unsubscribe/$gid/$account->uid", array('query' => "destination=og/users/$gid")) . ')';
 
     $form['user_roles']['roles'][$account->uid] = array(
-      //      '#type' => 'checkbox_columns',
       '#type' => 'checkboxes',
       '#title' => $title,
       '#default_value' => _og_user_roles_get_roles($account->uid, $roles),
@@ -810,7 +838,6 @@ function og_user_roles_page_form($form_v
       '#suffix' => '<br style="clear: both;" />',
     );
   }
-
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
 
   return $form;
@@ -820,7 +847,6 @@ function og_user_roles_page_form($form_v
  * Process the form submission.
  */
 function og_user_roles_page_form_submit($form, &$form_state) {
-
   // Added this to get gid
   if (is_numeric(arg(2))) {
     $gid = (int)arg(2);
@@ -853,10 +879,12 @@ function og_user_roles_page_form_submit(
  * Return an array of just the roles assignable by this user
  *
  * @return
- *  Array containing roles that this user may assign according to variable_get('og_user_roles_permissions', '').
+ *   Array containing roles that this user may assign according to
+ *   variable_get('og_user_roles_permissions', '').
  */
 function og_user_roles_get_roles() {
   global $user;
+
   $output = array();
 
   // If this user has 'configure member roles' permission, then he has
@@ -884,13 +912,13 @@ function og_user_roles_get_roles() {
 }
 
 /**
- * Return an array of permissions and roles assignable by the permissions
+ * Return an array of permissions and roles assignable by the permissions.
  *
  * @param $table
- *  Plain text table from variable_get('og_user_roles_permissions', '')
+ *   Plain text table from variable_get('og_user_roles_permissions', '')
  *
  * @return
- *  Array containing permissions and roles assignable by those permissions.
+ *   Array containing permissions and roles assignable by those permissions.
  */
 function og_user_roles_get_role_permissions($table) {
   $output = array();
@@ -911,10 +939,9 @@ function og_user_roles_get_role_permissi
 }
 
 /**
- * This checks to see what roles a current user has against a given set of roles.
+ * Check to see what roles a current user has against a given set of roles.
  */
 function _og_user_roles_get_roles($uid, $roles = array()) {
-
   // Added this to get gid
   if (is_numeric(arg(2))) {
     $gid = (int)arg(2);
@@ -937,25 +964,24 @@ function _og_user_roles_get_roles($uid, 
  * Theme function to render the table for the og_user_roles form.
  */
 function theme_og_user_roles_page_form($form) {
-  $output .= "\n<div id=\"og-roles-form\">\n";
+  $output = '<div id="og-roles-form">';
   $output .= '<div id="desc">' . t('Here you can assign group roles to members. This will give that member the permissions of that role in this group. It will apply to all posts within this group and will only apply to posts within this group.') . "</div>\n";
+
   $header[] = array('data' => t('Roles'), 'colspan' => 2);
   $rows = array();
-
   $i = 0;
   foreach ($form['user_roles']['users'] as $user_form) {
     $uid = $user_form['#value'];
-
     if ($uid) {
       $rows[$i][] = drupal_render($form['user_roles']['roles'][$uid]);
       $i++;
     }
   }
-
   $output .= theme('table', $header, $rows, array('id' => 'og-roles-table'));
   $output .= drupal_render($form['submit']);
   $output .= "</div>\n";
   $output .= drupal_render($form);
+
   return $output;
 }
 
@@ -965,8 +991,8 @@ function theme_og_user_roles_page_form($
  * @param $nid
  *   A node ID
  *
- * @return boolean
- *   TRUE if this group type allows roles to be assigned, otherwise FALSE
+ * @return
+ *   TRUE if this group type allows roles to be assigned, otherwise FALSE.
  */
 function og_user_roles_is_allowed($nid) {
   $node = node_load($nid);
@@ -984,8 +1010,8 @@ function og_user_roles_is_allowed($nid) 
  * @param $nid
  *   A node ID
  *
- * @return boolean
- *   TRUE if this group type allows roles to be assigned, otherwise FALSE
+ * @return
+ *   TRUE if this group type allows roles to be assigned, otherwise FALSE.
  */
 function og_user_roles_restricted_is_allowed($nid) {
   $node = node_load($nid);
@@ -1000,12 +1026,16 @@ function og_user_roles_restricted_is_all
 /**
  * Add role to og_users_roles table.
  *
- * @param $uid the user ID
- * @param $rid the role ID
- * @param $gid node ID of the group for the user in this role
+ * @param $uid
+ *   The user ID.
+ * @param $rid
+ *   The role ID.
+ * @param $gid
+ *   Node ID of the group for the user in this role.
  *
  * There is no return parameter, but "hook_og()" is invoked with args:
- * 'rid' (role ID) and 'ogr_id' (og_users_roles table ID for the newly created record).
+ * 'rid' (role ID) and 'ogr_id' (og_users_roles table ID for the newly created
+ * record).
  */
 function og_user_roles_role_join($uid, $rid, $gid) {
   // Modification.  http://drupal.org/node/174773
@@ -1063,7 +1093,7 @@ function og_user_roles_variable_remove($
  * Creates multiple checkbox columns
  */
 function expand_checkbox_columns($element) {
-  $value            = is_array($element['#value']) ? $element['#value'] : array();
+  $value = is_array($element['#value']) ? $element['#value'] : array();
   $element['#type'] = 'checkboxes';
   $element['#tree'] = TRUE;
 
@@ -1095,6 +1125,7 @@ function expand_checkbox_columns($elemen
 
 /**
  * Added the following functions from this snippet: http://drupal.org/node/41936
+ *
  * To let Drupal know about the new "expand_checkbox_columns".
  */
 function og_user_roles_elements() {
@@ -1347,8 +1378,7 @@ function og_user_roles_views_data() {
 }
 
 /**
- * Implementation of hook_views_handlers() to register all of the basic handlers
- * views uses.
+ * Implementation of hook_views_handlers() to register all of the basic handlers views uses.
  */
 function og_user_roles_views_handlers() {
   return array(
@@ -1381,8 +1411,7 @@ function og_user_roles_views_handlers() 
   );
 }
 
-
-/*
+/**
  * Create a list of group names and IDs.
  */
 function views_handler_filter_group() {
@@ -1403,9 +1432,7 @@ function views_handler_filter_group() {
 /**
  * Based on og_handler_filter_picg
  * Should restrict queries that use og_users_roles table to the current group.
- *
- * @return void
- **/
+ */
 function og_user_roles_handler_filter($op, $filter, $filterinfo, &$query) {
   $query->ensure_table('og_users_roles');
   $query->add_where("og_users_roles.gid = ***CURRENT_GID***");
@@ -1453,8 +1480,8 @@ function og_user_roles_checkview($viewna
   return $result;
 }
 
-/*
- * Implementation of hook_boot() (was hook_init()).
+/**
+ * Implementation of hook_boot().
  *
  * Got the idea of re-directing if this is a add group node request
  * from here: http://drupal.org/project/globalredirect
@@ -1499,30 +1526,30 @@ function og_user_roles_boot() {
 
     // Get rid of Create Content 'node/add?gids[]'
     $pattern = '/q\=.*node\/add\&gids\[\]\=(\d+)/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of Create Content 'node/ognodeadd&gids[]'
     $pattern = '/q\=.*node\/ognodeadd\&gids\[\]\=(\d+)/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of Create Content 'node/ognodeadd&type='
     $pattern = '/q\=.*node\/ognodeadd\&type\=(\w+)/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of 'node/add followed by &'
     $pattern = '/q\=.*node\/add\/[^\&]+\&/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of 'node/add followed which ends the line'
     $pattern = '/q\=.*node\/add\/[^\&]+$/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of 'gids[]='
     // Modified to include original query: http://drupal.org/node/381570
     //      $pattern = '/.*gids\[\]\=(\d+)[\&]?/i';
     $pattern = '/[\?|\&]gids\[\]\=(\d+)[\&]?/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of 'node/ognodeadd'
     $pattern = '/q\=.*node\/ognodeadd/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
     // Get rid of '&' if it starts a line
     $pattern = '/^\&/i';
-    $orig_query = preg_replace($pattern, "", $orig_query);
+    $orig_query = preg_replace($pattern, '', $orig_query);
 
     // If this is a group node/add, re-direct to ognodeadd
     if (arg(0) == 'node' && arg(1) == 'add' && isset($_REQUEST['gids']) && (!in_array(arg(2), $exempted))) {
@@ -1544,7 +1571,7 @@ function og_user_roles_boot() {
         $query = 'type=' . $type . '&gids[]=' . $gid . '&tid=' . intval(arg(3));
       }
 
-      // Modification to make it work with module "Relativity"
+      // Modification to make it work with module 'Relativity'
       // http://drupal.org/node/166253
       if (module_exists('relativity')) {
         if (arg(3) == 'parent' && is_numeric(arg(4))) {
@@ -1568,7 +1595,7 @@ function og_user_roles_boot() {
         // eliminate the one in the new query.
         if (preg_match('/gids\[\]/', $query) && preg_match('/gids\[\]/', $orig_query)) {
           $pattern = '/\&gids\[\]\=(\d+)/i';
-          $query = preg_replace($pattern, "", $query);
+          $query = preg_replace($pattern, '', $query);
         }
         $query = $query . '&' . $orig_query;
       }
@@ -1586,13 +1613,12 @@ function og_user_roles_boot() {
       if (!empty($gid) && $gid != 0) {
         $path = 'node/ognodeadd';
         $query = 'type=' . $type . '&gids[]=' . $gid . '&tid=' . $tid;
-        //        if ($orig_query) {          $query = $query . '&' . $orig_query;        }
         if ($orig_query) {
           // If the original query and the new query both contain gids[], then
           // eliminate the one in the new query.
           if (preg_match('/gids\[\]/', $query) && preg_match('/gids\[\]/', $orig_query)) {
             $pattern = '/\&gids\[\]\=(\d+)/i';
-            $query = preg_replace($pattern, "", $query);
+            $query = preg_replace($pattern, '', $query);
           }
           $query = $query . '&' . $orig_query;
         }
@@ -1605,7 +1631,6 @@ function og_user_roles_boot() {
     // then re-direct to ognodeadd
     // But, make sure you don't redirect for omitted nodes.
     if (arg(0) == 'node' && arg(1) == 'add' && isset($_SESSION['og_last']) && (!is_null(arg(2))) && (!in_array(arg(2), $exempted))) {
-
       $gid = $_SESSION['og_last'];
 
       $type = arg(2);
@@ -1626,7 +1651,7 @@ function og_user_roles_boot() {
 
         $query = 'type=' . $type . '&gids[]=' . $gid;
 
-        // Modification to make it work with module "Relativity"
+        // Modification to make it work with module 'Relativity'
         // http://drupal.org/node/166253
         if (module_exists('relativity')) {
           if (arg(3) == 'parent' && is_numeric(arg(4))) {
@@ -1644,13 +1669,12 @@ function og_user_roles_boot() {
           $path .= '/book/parent/' . arg(4);
         }
 
-        //        if ($orig_query) {          $query = $query . '&' . $orig_query;        }
         if ($orig_query) {
           // If the original query and the new query both contain gids[], then
           // eliminate the one in the new query.
           if (preg_match('/gids\[\]/', $query) && preg_match('/gids\[\]/', $orig_query)) {
             $pattern = '/\&gids\[\]\=(\d+)/i';
-            $query = preg_replace($pattern, "", $query);
+            $query = preg_replace($pattern, '', $query);
           }
           $query = $query . '&' . $orig_query;
         }
@@ -1659,7 +1683,7 @@ function og_user_roles_boot() {
     }
 
     // Modification for og_vocab: http://drupal.org/node/162649
-    // This allows a group role with "administer taxonomy" permission to edit
+    // This allows a group role with 'administer taxonomy' permission to edit
     // og_vocab terms.  If this is an og_vocab term edit:
     //   a. Get the group and tid
     //   b. re-direct to destination
@@ -1667,8 +1691,8 @@ function og_user_roles_boot() {
     if (module_exists('og_vocab')) {
       if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'taxonomy' && arg(3) == 'edit' && arg(4) == 'term' && is_numeric(arg(5)) && isset($_REQUEST['destination'])) {
         $destination = $_GET['destination'];
-        $tid         = arg(5);
-        $gid         = og_user_roles_gid_from_og_vocab_tid($tid);
+        $tid = arg(5);
+        $gid = og_user_roles_gid_from_og_vocab_tid($tid);
 
         $query = '&gids[]=' . $gid . '&tid=' . $tid . '&newdestination=' . $destination;
 
@@ -1680,10 +1704,10 @@ function og_user_roles_boot() {
       // This is the destination path for og_vocab term edit redirection above
       if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'og' && arg(3) == 'vocab' && arg(4) == 'terms' && is_numeric(arg(5)) && isset($_REQUEST['gids']) && isset($_REQUEST['tid'])) {
         $destination = $_GET['newdestination'];
-        $tid         = $_GET['tid'];
-        $gids        = $_GET['gids'];
-        $gid         = intval(current($_REQUEST['gids']));
-        $path        = 'node/ogtermedit';
+        $tid = $_GET['tid'];
+        $gids = $_GET['gids'];
+        $gid = intval(current($_REQUEST['gids']));
+        $path = 'node/ogtermedit';
 
         $query = 'gids[]=' . $gid . '&tid=' . $tid . '&destination=' . $destination;
 
@@ -1692,7 +1716,7 @@ function og_user_roles_boot() {
       }
     }
     // Modification for modr8: http://drupal.org/node/162649
-    // This allows a group role with "moderate content" permission to view
+    // This allows a group role with 'moderate content' permission to view
     // the modr8_log for events related to nodes he has access to.
     if (module_exists('modr8')) {
       if (arg(0) == 'admin' && arg(1) == 'logs' && arg(2) == 'modr8' && arg(3) == 'event' && is_numeric(arg(4))) {
@@ -1710,13 +1734,6 @@ function og_user_roles_boot() {
     // Add groupID if we are in group context.
     if (module_exists('ad')) {
       if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'ad' && (arg(3) == 'image' || arg(3) == 'text') && isset($_SESSION['og_last']) && (!isset($_REQUEST['gids']))) {
-        //        $gid = $_SESSION['og_last'];
-        //        $uri_request_id = request_uri();
-        //        $this_url = parse_url($uri_request_id);
-        //        $this_path = $this_url[path];
-        //        $this_path = ltrim($this_path, "\/");
-        //        $path = $this_path;
-
         $gid            = $_SESSION['og_last'];
         $uri_request_id = request_uri();
         $this_url       = parse_url($uri_request_id);
@@ -1736,13 +1753,6 @@ function og_user_roles_boot() {
     // Add groupID if we are in group context.
     if (module_exists('minutes')) {
       if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'minutes' && is_numeric(arg(3)) && isset($_SESSION['og_last']) && (!isset($_REQUEST['gids']))) {
-        //        $gid = $_SESSION['og_last'];
-        //        $uri_request_id = request_uri();
-        //        $this_url = parse_url($uri_request_id);
-        //        $this_path = $this_url[path];
-        //        $this_path = ltrim($this_path, "\/");
-        //        $path = $this_path;
-
         $gid            = $_SESSION['og_last'];
         $uri_request_id = request_uri();
         $this_url       = parse_url($uri_request_id);
@@ -1763,34 +1773,32 @@ function og_user_roles_boot() {
     // But the referrer is http://clients.brixrealtyinc.com/oguseredit/76/edit?gids[]=47
     // Then redirect back to referrer.
     // As a result of http://drupal.org/node/176662 this can only be done if the
-    // "Allow group admins to approve users" setting is checked on.
+    // 'Allow group admins to approve users' setting is checked on.
     if (variable_get('og_user_roles_approval_default', 0) === 1 && ((!user_access('access administration pages')) && (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) != 1) || (arg(0) == 'admin' && arg(1) == 'user' && arg(2) == 'user'))) {
-      $ref       = $_SERVER["HTTP_REFERER"];
+      $ref       = $_SERVER['HTTP_REFERER'];
       $ref_url   = parse_url($ref);
       $ref_path  = $ref_url[path];
       $ref_query = $ref_url[query];
       $ref_arg   = explode('/', $ref_path);
 
-      //      drupal_set_message('ref_query = ' . $ref_query);
-
       // Hijack only if the referrer contains oguseredit;
       if ($ref_arg[1] == 'oguseredit' && arg(2) != 'user') {
         // If user clicks delete from user edit screen. Gets you to the
-        // "delete" confirmation.
+        // 'delete' confirmation.
         if (arg(2) == 'delete') {
           $temp  = substr($ref_path, 1);
-          $path  = str_replace("/edit", "/delete", $temp);
+          $path  = str_replace('/edit', '/delete', $temp);
           $query = $ref_query;
           drupal_goto($path, $query);
         }
-        // If user clicks "submit" from user edit screen - just takes you back
+        // If user clicks 'submit' from user edit screen - just takes you back
         // to the same edit screen.
         if ($ref_arg[3] == 'edit') {
           $path = substr($ref_path, 1);
           $query = $ref_query;
           drupal_goto($path, $query);
         }
-        // If user clicks "delete" or "cancel" from delete confirmation screen.
+        // If user clicks 'delete' or 'cancel' from delete confirmation screen.
         // Takes you to group home page.
         if ($ref_arg[3] == 'delete') {
           parse_str($ref_query);
@@ -1802,7 +1810,6 @@ function og_user_roles_boot() {
     }
     // If this is a group relativity or book module node/add, re-direct to ognodeadd
     if (arg(0) == 'node' && arg(1) == 'add' && is_numeric(arg(4)) && (!in_array(arg(2), $exempted))) {
-
       $type = arg(2);
       $path = 'node/ognodeadd';
 
@@ -1812,7 +1819,7 @@ function og_user_roles_boot() {
 
       $query = 'type=' . $type . '&gids[]=' . $gid;
 
-      // Modification to make it work with module "Relativity"
+      // Modification to make it work with module 'Relativity'
       // http://drupal.org/node/166253
       // http://drupal.org/node/227978
       if (module_exists('relativity')) {
@@ -1840,7 +1847,6 @@ function og_user_roles_boot() {
  * Got this code from here: http://drupal.org/node/28379#comment-132430
  */
 function og_user_roles_user($op, &$edit, &$user, $category = NULL) {
-
   if ($op == 'insert') {
     // Registration Code
     // only present during registration
@@ -1869,7 +1875,7 @@ function og_user_roles_user($op, &$edit,
     }
 
     // If site requires admin approval and group admins are allowed to approve users
-    // Variable "user_register" values: 0 = Admin Only, 1 = No Admin Approval, 2 = Admin Approval
+    // Variable 'user_register' values: 0 = Admin Only, 1 = No Admin Approval, 2 = Admin Approval
     if (variable_get('og_user_roles_approval_default', 0) == 1 && (variable_get('user_register', 1) == 2 || ($user->status == 0))) {
       watchdog('new_user: status', 'user->status = ' . $user->status, WATCHDOG_NOTICE);
       if (is_array($edit['og_register'])) {
@@ -1886,7 +1892,7 @@ function og_user_roles_user($op, &$edit,
           else {
             $view_user = "user/$user->uid";
           }
-          $message = "The registration application for user " . l($user->name, $view_user, array('query' => "gids[]=$gid", 'absolute' => TRUE)) . " is pending approval.  You are the administrator for at least one of the groups to which this user has also applied to subscribe : " . l($group, "node/$gid", array('absolute' => TRUE)) . ".<p>You can click " . l("here", "$view_user/edit", array('query' => "gids[]=$gid", 'absolute' => TRUE)) . " to Activate, Block or Delete the user. (Don't forget to first log into group for which you are admin.)";
+          $message = 'The registration application for user ' . l($user->name, $view_user, array('query' => "gids[]=$gid", 'absolute' => TRUE)) . ' is pending approval.  You are the administrator for at least one of the groups to which this user has also applied to subscribe : ' . l($group, "node/$gid", array('absolute' => TRUE)) . '.<p>You can click ' . l('here', "$view_user/edit", array('query' => "gids[]=$gid", 'absolute' => TRUE)) . " to Activate, Block or Delete the user. (Don't forget to first log into group for which you are admin.)";
           $result = db_query("SELECT uid FROM {og_uid} WHERE is_admin = 1 AND nid = %d", $gid);
 
           while ($obj = db_fetch_object($result)) {
@@ -1897,7 +1903,6 @@ function og_user_roles_user($op, &$edit,
               mimemail($sender, $recipient, $subject, $message);
             }
           }
-          // end while
         }
       }
     }
@@ -1914,7 +1919,6 @@ function og_user_roles_user($op, &$edit,
       if ($output == 0) {
         // Modified as per: http://drupal.org/node/372700
         $edit['roles'][$rid] = $rid;
-        //        db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $user->uid, $rid);
       }
     }
   }
@@ -1946,14 +1950,12 @@ function og_user_roles_user($op, &$edit,
     $roles = og_user_roles_all_roles($user);
     $user->roles = $roles;
   }
-  // end $op load
 
   // Remove user info from og_users_roles table
   if ($op == 'delete') {
     // delete all records for this user
     db_query("DELETE FROM {og_users_roles} WHERE uid = %d", $user->uid);
   }
-  // end $op delete
 
   // Add the group roles to user's account display
   if ($op == 'view') {
@@ -1971,7 +1973,6 @@ function og_user_roles_user($op, &$edit,
       '#access' => user_access('administer organic groups') || $user->uid == arg(1),
     );
   }
-  // end $op view
 }
 
 /**
@@ -1983,11 +1984,9 @@ function og_user_roles_user($op, &$edit,
  * @param $args associative array containing details about the subscription
  */
 function og_user_roles_og($op, $nid, $uid, $args = array()) {
-
   switch ($op) {
     case 'user insert':
       global $base_url;
-
       // --- Modification - 2007-06-18 - as per: http://drupal.org/node/152442
       // Adding every user to a basic group restricted role, that all users in the group should have.
       // I don't know a better way, so I'll do it like this. This is based on the creating of a founder role,
@@ -2049,7 +2048,7 @@ function og_user_roles_og($op, $nid, $ui
           $view_user = "user/$user->uid";
         }
         // http://www.scbbs.com/node/135/219#comment-219
-        $message = "User " . l($user->name, $view_user, array('query' => "gids[]=$nid", 'absolute' => TRUE)) . " added to group: " . l($group, "node/$nid", array('absolute' => TRUE));
+        $message = 'User ' . l($user->name, $view_user, array('query' => "gids[]=$nid", 'absolute' => TRUE)) . ' added to group: ' . l($group, "node/$nid", array('absolute' => TRUE));
         $result = db_query("SELECT uid FROM {og_uid} WHERE is_admin = 1 AND nid = %d", $nid);
 
         while ($obj = db_fetch_object($result)) {
@@ -2093,7 +2092,6 @@ function og_user_roles_og($op, $nid, $ui
 function og_user_roles_node_info() {
   // If og_subgroups is installed AND og_user_roles_create_subgroup checkbox is checked;
   if (module_exists('og_subgroups') && variable_get('og_user_roles_create_subgroup', 0) == 1) {
-
     return array(
       'og_user_roles_subgroup' => array(
         'name' => t('Subgroup'),
@@ -2120,7 +2118,6 @@ function og_user_roles_nodeapi(&$node, $
       break;
 
     case 'insert':
-
       // If this is a group node, put the group creator into a group role upon creation;
       if (og_is_group_type($node->type)) {
         $type = $node->type;
@@ -2143,16 +2140,12 @@ function og_user_roles_nodeapi(&$node, $
         $gid      = $gids[0];
         $subgroup = $node->nid;
         // See http://drupal.org/node/432544
-        //        $sql = 'INSERT INTO {og_ancestry} (nid,group_nid,is_public) VALUES (%d,%d,0)';
         $sql = 'INSERT INTO {og_ancestry} (nid,group_nid) VALUES (%d,%d)';
         db_query($sql, $subgroup, $gid);
-        // This table no longer supported in og_subgroups 6.x.
-        // if (module_exists('og_subgroups')) db_query('INSERT INTO {og_subgroups} (gid, parent) {   VALUES (%d, %d)', $subgroup, $gid); }
       }
       break;
 
     case 'update':
-
       // Modification. 2007-09-24 as per: http://drupal.org/node/178257
       // If this is a group node, put the group creator into a group role upon creation
       // OR when the group node is updated.  If user already is in that role in the group,
@@ -2218,7 +2211,6 @@ function og_user_roles_nodeapi(&$node, $
               if ((arg(2) == 'edit' || arg(2) == 'delete') && $gid > 0) {
                 $access = FALSE;
                 $module = node_get_types('module', $type);
-
                 $perms = module_invoke($module, 'perm');
                 foreach ($perms as $string) {
                   // If this is an edit string
@@ -2271,10 +2263,10 @@ function og_user_roles_nodeapi(&$node, $
               $containers = variable_get('forum_containers', array());
               $my_containers = array_intersect($containers, $forums);
               // Get the list of names for forum containers for this group
-              $names = "";
+              $names = '';
               foreach ($my_containers as $item) {
                 $temp = taxonomy_get_term($item);
-                $names .= $temp->name . "  ";
+                $names .= $temp->name . '  ';
               }
               // Get the vocabulary terms for this node
               foreach ($node->taxonomy as $term) {
@@ -2303,30 +2295,27 @@ function og_user_roles_nodeapi(&$node, $
       if (og_is_group_type($node->type)) {
         og_user_roles_role_remove($node->nid);
         og_user_roles_variable_remove($node->nid);
-        // This table no longer supported in og_subgroups 6.x.
-        // if (module_exists('og_subgroups')) {   db_query('DELETE FROM {og_subgroups} WHERE gid = %d', $node->nid); }
       }
       break;
   }
 }
 
 /**
- * Use this function to determine whether a user has a given privilege
- * in a particular group.
+ * Use this function to determine whether a user has a given privilege in a particular group.
  *
  * @param $string
- *   The permission, such as "administer nodes", being checked for.
+ *   The permission, such as 'administer nodes', being checked for.
  * @param $gid
  *   The group id of the OG group.
  * @param $uid
  *   The uid of the user.
  *
  * @return
- *   boolean TRUE if the current user has the requested permission.
+ *   TRUE if the current user has the requested permission.
  */
 function og_user_roles_user_access($string, $gid, $uid) {
   $roles = array();
-  $perms = "";
+  $perms = '';
 
   // User #1 has all privileges:
   if ($uid == 1) {
@@ -2368,7 +2357,6 @@ function og_user_roles_get_groups($node)
     while ($row = db_fetch_object($result)) {
       $groups[$row->group_nid] = $row->title;
     }
-
     return $groups;
   }
 }
@@ -2388,7 +2376,6 @@ function og_user_roles_get_groups_result
  * of group and non-group roles for this user.
  */
 function og_user_roles_all_roles($user) {
-
   // added as per this issue: http://drupal.org/node/149469
   drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
   // added as per this issue: http://drupal.org/node/149469
@@ -2416,9 +2403,7 @@ function og_user_roles_all_roles($user) 
   //
   // We get the groupID
   //
-
   drupal_load('module', 'og');
-  //  require_once("modules/og/og.module");
 
   $group_node = og_get_group_context();
   $gid02      = $group_node->nid;
@@ -2433,9 +2418,7 @@ function og_user_roles_all_roles($user) 
     $_SESSION['og_user_role'] = $gid;
   }
 
-  //
   // If the above doesn't get the groupID, then we start trying stuff
-  //
   if ($gid == 0) {
     // http://doadance.scbbs.com/drupal03/node/79
     if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
@@ -2449,8 +2432,6 @@ function og_user_roles_all_roles($user) 
       $nid = intval($_REQUEST['translation']);
       $gid = og_user_roles_getgid($nid, $uid);
       if ($gid) {
-        // Troubleshooting
-        // drupal_set_message('recognized translation node add, gid = '.$gid);
         // inject gid
         $_GET['gids'] = array($gid);
       }
@@ -2462,14 +2443,14 @@ function og_user_roles_all_roles($user) 
     // http://doadance.scbbs.com/node/79/modr8
     // http://doadance.scbbs.com/node/79/ogmodr8
 
-    // Modified 2007-07-05 for webform "results";
-    // Modified 2007-07-23 for content_access "access";
-    // Modified 2007-08-06 for modr8 "modr8" and "ogmodr8" (our own callback);
-    // Modified 2007-09-13 for "galleries";
-    // Modified 2007-09-14 for "email";
-    // Modified 2007-12-20 for "revisions": http://drupal.org/node/202196
-    // Modified 2008-01-10 for "workflow": http://drupal.org/node/208363
-    // Modified 2008-03-21 for "feedapi": http://drupal.org/node/237258
+    // Modified 2007-07-05 for webform 'results';
+    // Modified 2007-07-23 for content_access 'access';
+    // Modified 2007-08-06 for modr8 'modr8' and 'ogmodr8' (our own callback);
+    // Modified 2007-09-13 for 'galleries';
+    // Modified 2007-09-14 for 'email';
+    // Modified 2007-12-20 for 'revisions': http://drupal.org/node/202196
+    // Modified 2008-01-10 for 'workflow': http://drupal.org/node/208363
+    // Modified 2008-03-21 for 'feedapi': http://drupal.org/node/237258
     // Modified 2008-12-24: How about just looking for nid in /node/<nid> instead of trying to
     //                      anticipate each and every module.
     // if (arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'outline' || arg(2) == 'track' || arg(2) == 'results' || arg(2) == 'access' || arg(2) == 'modr8' || arg(2) == 'ogmodr8' || arg(2) == 'delete' || arg(2) == 'galleries' || arg(2) == 'email' || arg(2) == 'revisions' || arg(2) == 'signups' || arg(2) == 'agenda' || arg(2) == 'workflow' || arg(2) == 'votes' || arg(2) == 'refresh' || arg(2) == 'purge')) {
@@ -2490,9 +2471,8 @@ function og_user_roles_all_roles($user) 
     //
     // This will get a group context if the current user and the
     // user he is trying to access both belong to at least the same
-    // group that is also the last group set by OG in "og_last" session
+    // group that is also the last group set by OG in 'og_last' session
     // (which logically should be the current group);
-    //
     // http://doadance.scbbs.com/oguseredit/72?gids[]=47
     // http://doadance.scbbs.com/oguseredit/72/delete?gids[]=47
     // http://doadance.scbbs.com/oguseredit/72/edit?gids[]=47
@@ -2505,7 +2485,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // print.module (printer friendly)
-    //
     // http://www.mysite.com/print/14
     if (arg(0) == 'print' && is_numeric(arg(1))) {
       header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
@@ -2524,7 +2503,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // oglogo (printer friendly)
-    //
     // http://www.mysite.com/oglogo
     if (arg(0) == 'oglogo') {
       if (isset($_SESSION['og_last'])) {
@@ -2541,13 +2519,11 @@ function og_user_roles_all_roles($user) 
     // This will get a group context from og_last session
     // and list all users in the group if the user listing
     // is admin for the group and has the 'administer users' permission.
-    //
     // http://doadance.scbbs.com/ogusermanage/47
     if (arg(0) == 'ogusermanage' AND is_numeric(arg(1))) {
       $gid = (int)arg(1);
     }
 
-    //                           0    1    2
     // http://www.mysite.com/comment/edit/14
     if (arg(0) == 'comment' && is_numeric(arg(2)) && arg(1) == 'edit') {
       $location = 3;
@@ -2559,7 +2535,6 @@ function og_user_roles_all_roles($user) 
       og_set_group_context($group_node);
     }
 
-    //                           0    1    2
     // http://www.mysite.com/comment/delete/14
     if (arg(0) == 'comment' && is_numeric(arg(2)) && arg(1) == 'delete') {
       $location = 31;
@@ -2568,7 +2543,6 @@ function og_user_roles_all_roles($user) 
       $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') {
       $location    = 4;
@@ -2578,7 +2552,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_term access
-    //                        0    1    2    3
     // http://www.mysite.com/node/add/forum/121
     if (arg(0) == 'node' && is_numeric(arg(3)) && arg(1) == 'add') {
       $location = 5;
@@ -2587,7 +2560,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // Here we get the gid directly
-    //
     // http://doadance.scbbs.com/node/79/view/tree
     // http://doadance.scbbs.com/node/79/view/members
     // http://doadance.scbbs.com/node/79/view
@@ -2597,7 +2569,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // Here we get the gid directly
-    //
     // http://doadance.scbbs.com/og/users/72
     // http://doadance.scbbs.com/og/manage/72
     if (arg(0) == 'og' && is_numeric(arg(2)) && is_null(arg(3))) {
@@ -2606,7 +2577,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_theme_settings
-    //
     // http://doadance.scbbs.com/admin/og/themes/edit/72
     if (arg(1) == 'og' && is_numeric(arg(4)) && arg(2) == 'themes') {
       $location = 60;
@@ -2617,7 +2587,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_vocab
-    //
     // http://doadance.scbbs.com/node/29/og/vocab
     if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'og') {
       $location = 61;
@@ -2625,11 +2594,8 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_vocab
-    //
-    // http://clients.brixrealtyinc.com/node/ogtermedit?destination=node%2F29%2Fog%2Fvocab%2Fterms%2F26&gids[]=29&tid=116
-    //
+http://clients.brixrealtyinc.com/node/ogtermedit?destination=node%2F29%2Fog%2Fvocab%2Fterms%2F26&gids[]=29&tid=116
     // Modification as per: http://drupal.org/node/162649
-    //
     if (arg(0) == 'node' && arg(1) == 'ogtermedit') {
       // Modification -- Get the gid from the variable instead of trying to calculate it.
       if (isset($_REQUEST['gids'])) {
@@ -2640,7 +2606,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_user_roles
-    //
     // http://doadance.scbbs.com/og/users/72/roles
     // http://doadance.scbbs.com/og/users/72/add
     if (arg(0) == 'og' && arg(1) == 'users' && is_numeric(arg(2)) && is_null(arg(4))) {
@@ -2650,10 +2615,8 @@ function og_user_roles_all_roles($user) 
 
     // og unsubscribe
     // og_user_roles
-    //
-    // This is sort of a catch all for "og" and gid in this order
+    // This is sort of a catch all for 'og' and gid in this order
     // og/<whatever>/<gid>
-    //
     // http://doadance.scbbs.com/og/unsubscribe/72
     // http://doadance.scbbs.com/og/users/72/add
     if (arg(0) == 'og' && is_numeric(arg(2))) {
@@ -2662,7 +2625,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_forum
-    //
     // http://doadance.scbbs.com/og_forum/manage/72
     if (arg(0) == 'og_forum' && arg(1) == 'manage' && is_numeric(arg(2)) && is_null(arg(3))) {
       $location = 65;
@@ -2677,7 +2639,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_calendar
-    //
     // http://www.centralavedance.com/og_calendar/2973/2007/07/01
     if (arg(0) == 'og_calendar' && is_numeric(arg(1))) {
       $location = 67;
@@ -2685,7 +2646,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og_forum
-    //         0           1    2       3
     // http://www.mysite.com/og_forum/39/72?edit[og_groups][]=72
     // http://www.mysite.com/og_forum/37/71?sort=asc&order=Replies&edit[og_groups][0]=71
     // Modification as per: http://drupal.org/node/155882 - replaced $uri_request_id
@@ -2712,7 +2672,6 @@ function og_user_roles_all_roles($user) 
     }
 
     // og create nodes (version 5.1)
-    //          0     1   2           3
     // http://sbn.scbbs.com/node/add/forum?gids[]=72
     // http://sbn.scbbs.com/node/add/simplenews?gids[]=72
     // http://sbn.scbbs.com/node/add/webform?gids[]=72
@@ -2731,11 +2690,8 @@ function og_user_roles_all_roles($user) 
     }
 
     // modr8 view modr8_log
-    //
     // http://clients.brixrealtyinc.com/node/ogmodr8?gids[]=12&event=2
-    //
     // Modification as per: http://drupal.org/node/164092
-    //
     if (arg(0) == 'node' && arg(1) == 'ogmodr8') {
       // Modification -- Get the gid from the variable instead of trying to calculate it.
       if (isset($_REQUEST['gids'])) {
@@ -2746,15 +2702,12 @@ function og_user_roles_all_roles($user) 
     }
 
     // og create nodes (custom node/20 aliased to node/ognodeadd)
-    //          0     1   2           3
     // http://clients.brixrealtyinc.com/node/ognodeadd?type=document&gids[]=12
-    //
     // Modification as per: http://drupal.org/node/155882
     // We use arg() instead of $arg[] ($uri_request_id)
-    //
     if (arg(0) == 'node' && arg(1) == 'ognodeadd') {
       // Modification -- Get the gid from the variable instead of trying to calculate it.
-      //        -- In case we need to add "tid=" to url as per:
+      //        -- In case we need to add 'tid=' to url as per:
       //        -- http://drupal.org/node/156568
       if (isset($_REQUEST['gids'])) {
         $location = 132;
@@ -2875,7 +2828,7 @@ function og_user_roles_all_roles($user) 
         $path     = $_SERVER['REQUEST_URI'];
         $basename = basename($path);
         $basename = urldecode($basename);
-        $basename = preg_replace("/\+/", " ", $basename);
+        $basename = preg_replace('/\+/', ' ', $basename);
         // Now, get the node associated with this file;
         // 6.x has different file structure
         //        $file = db_fetch_object(db_query("SELECT u.nid FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid where f.filepath like '%s'", '%' . $basename));
@@ -2897,7 +2850,7 @@ function og_user_roles_all_roles($user) 
 
     // Modification as per: http://drupal.org/node/204080
     // Galleries (view part: The view urls can have 'subdirs' so we may need to check until the nth arg)
-    if (module_exists("og_galleries")) {
+    if (module_exists('og_galleries')) {
       $og_gal_parts = split('/', og_galleries_get_url());
       if (!empty($og_gal_parts)) {
         $is_og_gal_url = TRUE;
@@ -2934,9 +2887,7 @@ function og_user_roles_all_roles($user) 
     }
   }
 
-  //
   // Now, using $uid and $gid we find out what roles this user has in this group;
-  //
   if (empty($gid)) {
     // This prevents us from getting error on non-group node/add
     $gid = 0;
@@ -2950,30 +2901,23 @@ function og_user_roles_all_roles($user) 
 
 /**
  * Modification as per http://drupal.org/node/189227
- * Makes sure use is "active" (not in moderation) before any of these group roles are added.
+ * Makes sure use is 'active' (not in moderation) before any of these group roles are added.
  * Was: $query = 'SELECT r.rid, r.name FROM {role} r INNER JOIN {og_users_roles} ogr ON r.rid = ogr.rid WHERE ogr.uid = %d AND ogr.gid = %d';
  */
 
   $query = 'SELECT r.rid, r.name FROM {role} r INNER JOIN {og_users_roles} ogr ON r.rid = ogr.rid INNER JOIN {og_uid} ogu ON ogu.uid = ogr.uid AND ogu.nid = ogr.gid WHERE ogr.uid = %d AND ogr.gid = %d AND ogu.is_active = 1';
   $results = db_query($query, $uid, $gid);
 
-  //
   // Create an array of these roles;
-  //
-
   while ($row = db_fetch_array($results)) {
     $x1 = $row['rid'];
     $ogroles[$x1] = $row['name'];
   }
 
-  //
   // First, we need to create an array of $user->roles
-  //
   $c = $user->roles;
 
-  //
   // Next, we add the $user->roles array to the $ogroles array, if there is an ogroles array;
-  //
   if ($x1 > 0) {
     $d = array();
     $d = $c + $ogroles;
@@ -2995,7 +2939,6 @@ function og_user_roles_all_roles($user) 
   }
 
   // $d is either the merged results, or just $user->roles;
-
   return $d;
 }
 
@@ -3015,7 +2958,6 @@ function og_user_roles_getgid($nid, $uid
   }
 
   // See if our user is a member of this node's group.
-  //
   if ($gid == 0) {
     $result = db_query("SELECT oga.group_nid from {og_ancestry} oga INNER JOIN {og_uid} ogu ON ogu.nid = oga.group_nid WHERE oga.nid = %d AND ogu.uid = %d", $nid, $uid);
     while ($t = db_fetch_object($result)) {
@@ -3025,12 +2967,8 @@ function og_user_roles_getgid($nid, $uid
 
   // If this user is not a member of this group (fails test above), and this is a public node,
   // then we just need to find the first group it belongs to.
-  //
-  // select og_ancestry.group_nid FROM og_ancestry WHERE og_ancestry.nid = 130 AND og_ancestry.is_public = 1
-  //
   if ($gid == 0) {
     // See: http://drupal.org/node/432544
-    //    $result = db_query("SELECT oga.group_nid FROM {og_ancestry} oga WHERE oga.nid = %d AND oga.is_public = 1", $nid);
     $result = db_query("SELECT oga.group_nid FROM {og_ancestry} oga WHERE oga.nid = %d", $nid);
     while ($t = db_fetch_object($result)) {
       $gid = $t->group_nid;
@@ -3133,7 +3071,7 @@ function og_user_roles_write_test($user,
   $test_string      = 'group context: ' . $gid02;
   $test_username    = $user->name;
   $test_group       = $gid;
-  $test_uri         = $uri_request_id . " (" . $ref . ")";
+  $test_uri         = $uri_request_id . ' (' . $ref . ')';
   $test_aarg0       = arg(0);
   $test_aarg1       = arg(1);
   $test_aarg2       = arg(2);
@@ -3182,7 +3120,6 @@ function og_user_roles_ognodeadd() {
     }
 
     $access = module_invoke($module, 'access', 'create', $type, $user);
-
     if ($access === TRUE) {
       $content_type = node_get_types('type', $type);
       $output = '<p>' . filter_xss_admin($content_type->help) . '</p>';
@@ -3190,10 +3127,6 @@ function og_user_roles_ognodeadd() {
     }
     else {
       $output = 'Access denied.';
-
-      // Old = type, message, severity, link
-      // New = type, message, variables, severity, link
-
       watchdog('access denied', 'User can not create this node type:<strong> ' . $type . '</strong>', $variables = array(), WATCHDOG_WARNING, 'node/ognodeadd?type=' . $type . '&gids[]=' . $gids[0]);
     }
   }
@@ -3270,7 +3203,7 @@ function og_user_roles_ogtermedit() {
  */
 function og_user_roles_ogmodr8() {
   global $user;
-  // Need this in order to not get "undefined function" on "modr8_log_event" call below
+  // Need this in order to not get 'undefined function' on 'modr8_log_event' call below
   require_once drupal_get_path('module', 'modr8') . '/modr8_admin.inc';
 
   // This returns normal $user->roles and includes OG roles if any
@@ -3303,7 +3236,6 @@ function og_user_roles_ogmodr8() {
  * Format: http://www.scbbs.com/oguseredit/76/edit?gids[]=47
  */
 function og_user_roles_oguseredit($uid = 0) {
-
   require_once drupal_get_path('module', 'user') . '/user.pages.inc';
 
   global $user;
@@ -3403,7 +3335,7 @@ function og_user_roles_user_manage($gid)
   }
 
   $items = db_query("SELECT uid FROM {users} ORDER BY name");
-  $output = "";
+  $output = '';
 
   while ($item = db_fetch_object($items)) {
     $uid          = $item->uid;
@@ -3413,14 +3345,14 @@ function og_user_roles_user_manage($gid)
     if ($common_gids) {
       foreach ($common_gids as $common) {
         if ($common == $this_gid && $is_admin == 1 && user_access('administer users') && $uid != 1) {
-          $output .= "<li>" . l($account->name, 'oguseredit/' . $uid, array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid)) . " | " . l('(edit)', 'oguseredit/' . $uid . '/edit', array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid . '&destination=og/users/' . $this_gid . '/manage')) . " | " . l('(delete)', 'oguseredit/' . $uid . '/delete', array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid . '&destination=og/users/' . $this_gid . '/manage')) . "</li>";
+          $output .= '<li>' . l($account->name, 'oguseredit/' . $uid, array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid)) . ' | ' . l('(edit)', 'oguseredit/' . $uid . '/edit', array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid . '&destination=og/users/' . $this_gid . '/manage')) . ' | ' . l('(delete)', 'oguseredit/' . $uid . '/delete', array('attributes' => $attributes = array(), 'query' => 'gids[]=' . $this_gid . '&destination=og/users/' . $this_gid . '/manage')) . '</li>';
         }
       }
     }
   }
 
-  if ($output == "") {
-    $output = "<strong>No users have been located for this group or you are not an admin user for this group!</strong>";
+  if ($output == '') {
+    $output = '<strong>No users have been located for this group or you are not an admin user for this group!</strong>';
   }
 
   return $output;
@@ -3431,7 +3363,6 @@ function og_user_roles_user_manage($gid)
  * oglogo
  */
 function og_user_roles_oglogo($uid) {
-
   header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
   header('Cache-Control: no-store, no-cache, must-revalidate');
   header('Cache-Control: post-check=0, pre-check=0', FALSE);
@@ -3446,12 +3377,12 @@ function og_user_roles_oglogo($uid) {
     $user = user_load(array('uid' => $uid));
   }
 
-  $location = "5";
+  $location = '5';
   $test_function = 'og_user_roles_oglogo';
 
   $addr = $_SERVER['REMOTE_ADDR'];
 
-  $ref       = $_SERVER["HTTP_REFERER"];
+  $ref       = $_SERVER['HTTP_REFERER'];
   $ref_url   = parse_url($ref);
   $ref_path  = $ref_url[path];
   $ref_query = $ref_url[query];
@@ -3465,7 +3396,7 @@ function og_user_roles_oglogo($uid) {
   $arg = explode('/', $uri_request_id);
 
   if ($group_node = og_get_group_context()) {
-    $location .= "A";
+    $location .= 'A';
     $gid                = $group_node->nid;
     $logo               = variable_get('og_user_roles_logo_' . $gid, '');
     $_SESSION['oglogo'] = $logo;
@@ -3473,7 +3404,7 @@ function og_user_roles_oglogo($uid) {
   }
 
   if ($ref_arg[1] == 'print' && is_numeric($ref_arg[2])) {
-    $location .= "B";
+    $location .= 'B';
     $nid                = (int)$ref_arg[2];
     $gid                = og_user_roles_getgid($nid, $uid);
     $logo               = variable_get('og_user_roles_logo_' . $gid, '');
@@ -3482,7 +3413,7 @@ function og_user_roles_oglogo($uid) {
   }
 
   if (arg(0) == 'print' && arg(2) == 'og' && is_numeric(arg(3))) {
-    $location .= "C";
+    $location .= 'C';
     $nid                = (int)arg(3);
     $gid                = og_user_roles_getgid($nid, $uid);
     $logo               = variable_get('og_user_roles_logo_' . $gid, '');
@@ -3491,7 +3422,7 @@ function og_user_roles_oglogo($uid) {
   }
 
   if ($ref_arg[1] == 'print' && is_numeric($ref_arg[4])) {
-    $location .= "D";
+    $location .= 'D';
     $nid                = (int)$ref_arg[4];
     $gid                = og_user_roles_getgid($nid, $uid);
     $logo               = variable_get('og_user_roles_logo_' . $gid, '');
@@ -3499,25 +3430,12 @@ function og_user_roles_oglogo($uid) {
     variable_set('oglogo_' . $addr, $logo);
   }
 
-
-  //  if (empty($logo) && $_SESSION['oglogo']) {
-  //    $location .= "E";
-  //    $logo = $_SESSION['oglogo'];
-  //  }
-
-  //  if (empty($logo) && isset($_SESSION['og_last'])) {
-  //    $location .= "F";
-  //    $nid = $_SESSION['og_last'];
-  //    $gid = og_user_roles_getgid($nid, $uid);
-  //    $logo = variable_get('og_user_roles_logo_' . $gid, '');
-  //  }
-
   // IE Print Problem: If we found $logo above, use this to locate it.
   // Problem is:  How do we not use this if logo is legitimately not found for group
   // after this user has found one that does exist?
   //
   if (empty($logo) && empty($ref) && empty($gid) && $user->uid == 0) {
-    $location .= "G";
+    $location .= 'G';
     $logo = variable_get('oglogo_' . $addr, '');
   }
 
@@ -3531,7 +3449,7 @@ function og_user_roles_oglogo($uid) {
   $d .= ')';
 
   if (empty($logo)) {
-    $location .= "H";
+    $location .= 'H';
     $logo = theme_get_setting('logo_path');
   }
 
@@ -3549,7 +3467,7 @@ function og_user_roles_oglogo($uid) {
 
   // If file is not an image file (or is unsupported) then return an error
   if (!$info['mime_type']) {
-    $text = "Unsupported Filetype: (" . $location . ")";
+    $text = 'Unsupported Filetype: (' . $location . ')';
     og_user_roles_oglogo_display_error($text);
     return;
   }
@@ -3577,12 +3495,12 @@ function og_user_roles_oglogo_gid($gid) 
   return $logo;
 }
 
-function og_user_roles_oglogo_display_error($text = "Error Creating Logo") {
+function og_user_roles_oglogo_display_error($text = 'Error Creating Logo') {
   $im        = imagecreate(181, 20);
   $bg        = imagecolorallocate($im, 255, 255, 255);
   $textcolor = imagecolorallocate($im, 255, 0, 0);
   imagestring($im, 5, 2, 1, $text, $textcolor);
-  header("Content-type: image/png");
+  header('Content-type: image/png');
   imagepng($im);
   imagedestroy($im);
 }
@@ -3632,11 +3550,10 @@ function og_user_roles_gid_from_modr8_ev
  * Get gid from session og_last or referrer
  */
 function og_user_roles_gid_from_referrer() {
-
   $gid = 0;
 
   // Need to use the referrer to get OG group in some cases;
-  $ref       = $_SERVER["HTTP_REFERER"];
+  $ref       = $_SERVER['HTTP_REFERER'];
   $ref_url   = parse_url($ref);
   $ref_path  = $ref_url[path];
   $ref_query = $ref_url[query];
@@ -3729,7 +3646,7 @@ function og_user_roles_form_alter(&$form
         }
       }
       // If the form loaded is this type then we can move on
-      if ($type != '' && $form_id == $type . "_node_form") {
+      if ($type != '' && $form_id == $type . '_node_form') {
         $form['og_user_roles_basicgrouprole_gid'] = array(
           '#type' => 'fieldset',
           '#title' => t('Default Basic Group Role for new subscribers to this group.'),
@@ -3773,7 +3690,7 @@ function og_user_roles_form_alter(&$form
       }
 
       // If the form loaded is this type then we can move on
-      if ($type != '' && $form_id == $type . "_node_form") {
+      if ($type != '' && $form_id == $type . '_node_form') {
 
         // Group Logo Location
         if (variable_get('og_user_roles_logo_enabled', '1')) {
@@ -3795,7 +3712,6 @@ function og_user_roles_form_alter(&$form
         }
 
         // Add the code to display 'Create content' link and/or remove 'create_' links.
-
         if (variable_get('og_user_roles_menu_options_enabled', 1)) {
           $form['og_user_roles_links_gid'] = array(
             '#type' => 'fieldset',
@@ -3895,7 +3811,7 @@ function og_user_roles_form_alter(&$form
     $rid = arg(4);
     // If the form loaded is this type then we want to run it by our submit function
     // which will test to see if it is a delete operation
-    if ($form_id == "user_admin_role") {
+    if ($form_id == 'user_admin_role') {
       $form['#submit'][] = 'og_user_roles_role_submit';
     }
   }
@@ -3923,7 +3839,7 @@ function og_user_roles_logo_form_validat
     $img_width  = $image['width'];
     $img_height = $image['height'];
     if ($img_width > $width || $img_height > $height) {
-      form_set_error('og_user_roles_logo_' . $gid, "Your submitted group logo image exceeds maximim image dimension limits.");
+      form_set_error('og_user_roles_logo_' . $gid, 'Your submitted group logo image exceeds maximim image dimension limits.');
     }
   }
 }
@@ -3959,7 +3875,7 @@ function og_user_roles_regcode_form_vali
       // If this value is blank, return error
       $regcode_array = explode(',', $form_state['values']['og_user_roles_regcode_value_' . $gid]);
       if (empty($regcode_array[0])) {
-        form_set_error('og_user_roles_regcode_value_' . $gid, "No valid registration code entered.");
+        form_set_error('og_user_roles_regcode_value_' . $gid, 'No valid registration code entered.');
       }
       // Get the list of OG groups
       $groups = og_all_groups_options();
@@ -3974,10 +3890,10 @@ function og_user_roles_regcode_form_vali
             if ($duplicated = array_intersect($regcode_array, $group_array)) {
               // If there are duplicates, then display the group in which they are duplicated ONLY if this is a site admin
               if (user_access('administer nodes')) {
-                form_set_error('og_user_roles_regcode_value_' . $gid, "Registration codes <strong>" . implode(', ', $duplicated) . "</strong> duplicated in group " . l($title, 'node/' . $group));
+                form_set_error('og_user_roles_regcode_value_' . $gid, 'Registration codes <strong>' . implode(', ', $duplicated) . '</strong> duplicated in group ' . l($title, 'node/' . $group));
               }
               else {
-                form_set_error('og_user_roles_regcode_value_' . $gid, "Registration codes <strong>" . implode(', ', $duplicated) . "</strong> duplicated.");
+                form_set_error('og_user_roles_regcode_value_' . $gid, 'Registration codes <strong>' . implode(', ', $duplicated) . '</strong> duplicated.');
               }
             }
           }
@@ -4080,7 +3996,7 @@ function og_user_roles_link_alter(&$link
  */
 function og_user_roles_og_create_links($group) {
   if (variable_get('og_user_roles_links_content_' . $group->nid, 0) == 1) {
-    $links[] = l(t('Create content'), "node/ognodeadd", array('title' => t('Add new content in this group.'), 'query' => 'gids[]=' . $group->nid));
+    $links[] = l(t('Create content'), 'node/ognodeadd', array('title' => t('Add new content in this group.'), 'query' => 'gids[]=' . $group->nid));
     return $links;
   }
 }
@@ -4092,7 +4008,6 @@ function og_user_roles_og_create_links($
  * Optionally remove create_ links.
  */
 function og_user_roles_og_links_alter(&$links, $group_node) {
-
   // Convert the dashes in the URL back to underscores.
   foreach ($links as $key => $value) {
     if (substr($key, 0, 7) == 'create_') {
@@ -4149,8 +4064,8 @@ function og_user_roles_block($op = 'list
             $attributes = array();
             $imglink = theme_image($logo, $alt = $node->title, $title = $node->title, $attributes, $getsize = FALSE);
             // Modification as per: http://drupal.org/node/287571
-            //            $output = "<a href='" . base_path() . "node/" . $node->nid . "'>" . $imglink . "</a>";
-            $output = "<a href='" . url('node/' . $node->nid) . "'>" . $imglink . "</a>";
+            //            $output = "<a href='" . base_path() . 'node/' . $node->nid . "'>" . $imglink . '</a>';
+            $output = "<a href='" . url('node/' . $node->nid) . "'>" . $imglink . '</a>';
             $block = array('content' => $output);
           }
         }
@@ -4163,12 +4078,12 @@ function og_user_roles_block($op = 'list
 /**
  * hook_og_block_details
  *
- * Trying to get this to work to put "Enter registration code" link in group menu
+ * Trying to get this to work to put 'Enter registration code' link in group menu
  * if in moderation.
  */
 function og_user_roles_og_block_details($group) {
   if ($group->og_selective == OG_MODERATED && variable_get('og_user_roles_assign_regcode_gid', 0) == 1 && variable_get('og_user_roles_assign_regcode_' . $group->nid, '') == 1) {
-    $links[] = l(t('Enter registration code'), "og/regcode", array('attributes' => array('title' => t('Subscribe to this group using a registration code.'))));
+    $links[] = l(t('Enter registration code'), 'og/regcode', array('attributes' => array('title' => t('Subscribe to this group using a registration code.'))));
   }
   $oldblock         = og_og_block_details($group);
   $block['content'] = $oldblock['content'] . theme('item_list', $links);
@@ -4218,13 +4133,13 @@ function og_user_roles_register_validate
   global $user;
   $gid = og_user_roles_gid_from_regcode($form_state['values']['og_user_roles_regcode']);
   if ($gid == 0) {
-    form_set_error('og_user_roles_regcode', "Not a valid group registration code.");
+    form_set_error('og_user_roles_regcode', 'Not a valid group registration code.');
   }
   if (!user_access('use registration codes')) {
-    form_set_error('og_user_roles_regcode', "You do not have permission to use registration codes!");
+    form_set_error('og_user_roles_regcode', 'You do not have permission to use registration codes!');
   }
   if (!$user->uid) {
-    form_set_error('og_user_roles_regcode', "You must be logged in to use registration codes!");
+    form_set_error('og_user_roles_regcode', 'You must be logged in to use registration codes!');
   }
 }
 
@@ -4268,7 +4183,7 @@ function og_user_roles_register_confirm(
     return confirm_form($form, $question, $path, $description, $yes, $no, $name);
   }
   else {
-    form_set_error('regcode', "Not a valid group registration code.");
+    form_set_error('regcode', 'Not a valid group registration code.');
   }
 }
 
@@ -4277,13 +4192,13 @@ function og_user_roles_register_confirm_
   $regcode = $form['#regcode'];
   $gid = og_user_roles_gid_from_regcode($regcode);
   if ($gid == 0) {
-    form_set_error('regcode', "Not a valid group registration code.");
+    form_set_error('regcode', 'Not a valid group registration code.');
   }
   if (!user_access('use registration codes')) {
-    form_set_error('regcode', "You do not have permission to use registration codes!");
+    form_set_error('regcode', 'You do not have permission to use registration codes!');
   }
   if (!$user->uid) {
-    form_set_error('regcode', "You must be logged in to use registration codes!");
+    form_set_error('regcode', 'You must be logged in to use registration codes!');
   }
 }
 
@@ -4322,7 +4237,7 @@ function og_user_roles_delete_regcode($g
     }
   }
   // Implode the new array
-  $new = implode(",", $new_array);
+  $new = implode(',', $new_array);
   // Write the new value.
   variable_set('og_user_roles_regcode_value_' . $gid, $new);
 }
@@ -4356,7 +4271,7 @@ function og_user_roles_og_status($node) 
 /**
  * Access callback
  * Determine access to modr8 page
- * Coded as per "Create your own access": http://drupal.org/node/109157
+ * Coded as per 'Create your own access': http://drupal.org/node/109157
  *
  * @param
  *   node id
@@ -4369,7 +4284,7 @@ function og_user_roles_modr8_access($nid
   // ToDo: Use og_user_roles_access to determine access.
   //  og_user_roles_user_access($access, $gid, $uid)
 
-  // This code doesn't work because it gives "access denied" once node is approved:
+  // This code doesn't work because it gives 'access denied' once node is approved:
   //  $node = node_load($nid);
   //  return $node->moderate && user_access($access);
 
@@ -4392,13 +4307,11 @@ function og_user_roles_node_grants($acco
  * Implementation of hook_node_access_records
  */
 function og_user_roles_node_access_records($node) {
-
   $grants = array();
 
   if (variable_get('og_user_roles_tac_og_value', 0) == 1) {
-
     // we need to explicitly label public nodes it seems. OG doesn't label nodes
-    // of types it doesn't apply to, or the "implicitly public" nodes created by
+    // of types it doesn't apply to, or the 'implicitly public' nodes created by
     // leaving all the audience checkboxes blank.
     // From: http://drupal.org/node/234087#comment-788876
 
@@ -4441,7 +4354,6 @@ function og_user_roles_node_access_recor
  * Implementation of hook_cron().
  */
 function og_user_roles_cron() {
-
   // Insert nodes into all groups.
   $nodelist = variable_get('og_user_roles_all_groups_nodes', '');
 
@@ -4451,7 +4363,7 @@ function og_user_roles_cron() {
 
     while ($row = db_fetch_object($result)) {
       foreach ($nodelist_array as $nodelist_item) {
-        print "<br>nodelist_item : " . $nodelist_item;
+        print '<br>nodelist_item : ' . $nodelist_item;
         $count = db_result(db_query("SELECT COUNT(nid) FROM {og_ancestry} WHERE nid = %d AND group_nid = %d", $nodelist_item, $row->nid));
         // Insert if it doesn't already belong.
         if ($count == 0) {
@@ -4490,7 +4402,6 @@ function og_user_roles_get_og_roles($uid
  * Implementation of hook_mail_alter().
  */
 function og_user_roles_mail_alter(&$message) {
-
   $mailkey = $message['mail_id'];
   $to      = $message['to'];
   $subject = $message['subject'];
@@ -4501,9 +4412,9 @@ function og_user_roles_mail_alter(&$mess
   if ($mailkey == 'og_mail') {
     // Get unsubscribe url
     $unsubscribe_url = $headers['List-Unsubscribe'];
-    // Take out the "<" and ">" characters
+    // Take out the '<' and '>' characters
     $url = preg_replace('/[\<|\>]/', '', $unsubscribe_url);
-    // Get the group number (i.e., http://www.less-paper.org/og/manage/16 will yield "16")
+    // Get the group number (i.e., http://www.less-paper.org/og/manage/16 will yield '16')
     $gid = basename($url);
     // Get the logo path
     $logo = og_user_roles_oglogo_gid($gid);
