drupaldrupal-6access-controlorganic-groups

Drupal Organic Groups: Automatically make all members group admins


I'm using Drupal 6 to build a web application which will be centered around small groups (using Organic Groups).
All the groups are invite only, and once a user is a member of the group I trust him to have full groups admin rights (e.g. invite other users).

Any ideas on how I can set all group members to be group admins by default.

Cheers.


Solution

  • The solution I found is implementing the og hook on the operation 'user insert', and rewriting the record with is_admin = 1:

    function supporttip_og($op, $gid, $uid, $args) {
      if($op == 'user insert') {
        $time = time();
        $subscription = array(
          'nid' => $gid,
          'uid' => $uid,
          'changed' => $time,
          'is_admin' => 1
        );
        drupal_write_record('og_uid', $subscription, array('nid', 'uid'));
      }
    }