Requesting approval to join a subgroup grants access to the parent group without approval.

ikogan - October 21, 2009 - 08:53
Project:Subgroups for Organic groups
Version:6.x-0.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

If you have OG setup to require approval for membership to groups and a user applies for membership for a subgroup then that user immediately becomes a member of the parent group, without requiring any sort of approval.

--- og_subgroups.module.old     2009-10-21 04:49:40.587976453 -0400
+++ og_subgroups.module 2009-10-21 04:49:33.131382429 -0400
@@ -216,7 +216,8 @@
         // 1) User isn't a member;
         // 2) or Admin propagation, and member isn't admin;
         // 3) or Admin demotion and user is member of the group.
-        elseif (!og_is_group_member($group_nid, TRUE, $account->uid) || ($is_admin && !$account->og_groups[$group_nid]['is_admin']) || (!empty($account->og_groups[$group_nid]['is_admin']) && !$args['is_admin'] && $demote['remove_admin'])) {
+        // 4) and registration has been approved
+        elseif ($args['is_active'] == 1 && (!og_is_group_member($group_nid, TRUE, $account->uid) || ($is_admin && !$account->og_groups[$group_nid]['is_admin']) || (!empty($account->og_groups[$group_nid]['is_admin']) && !$args['is_admin'] && $demote['remove_admin']))) {
           // Pass in the $args info about propagation done by og_subgroups module.
           og_save_subscription($group_nid, $uid, array('is_active' => 1, 'is_admin' => $is_admin, 'og_subgroups' => TRUE));
         }

AttachmentSize
og_subgroups.diff1.08 KB
 
 

Drupal is a registered trademark of Dries Buytaert.