Index: og.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/Attic/og.module,v retrieving revision 1.628.4.49 diff -u -p -r1.628.4.49 og.module --- og.module 21 Dec 2010 07:51:13 -0000 1.628.4.49 +++ og.module 13 Jan 2011 13:04:40 -0000 @@ -25,6 +25,10 @@ define('OG_DELETE_ORPHANS', 1); define('OG_DELETE_MOVE_NODES', 2); define('OG_DELETE_MOVE_NODES_MEMBERSHIPS', 3); +// Membership request defaults +define('OG_MEMBERSHIP_VISIBLE_TRUE', 0); +define('OG_MEMBERSHIP_VISIBLE_FALSE', 1); + /** * Implementation of hook_help(). */ @@ -1103,22 +1107,36 @@ function og_group_form($node, $form_stat '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'og_description') : -4, ); - $default = isset($node->og_selective) ? $node->og_selective : OG_OPEN; - $options = array( - t('Open - membership requests are accepted immediately.'), - t('Moderated - membership requests must be approved.'), - t('Invite only - membership must be created by an administrator.'), - t('Closed - membership is exclusively managed by an administrator.'), - ); - $form['og_selective'] = array( - '#type' => 'radios', - '#title' => t('Membership requests'), - '#required' => TRUE, - '#default_value' => $default, - '#options' => $options, - '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'og_selective') : 0, - '#description' => t('How should membership requests be handled in this group? When you select closed, users will not be able to join or leave.') - ); + $visibility = variable_get('og_membership_visible', OG_MEMBERSHIP_VISIBLE_TRUE); + if (user_access('administer nodes')) { + $visibility = OG_MEMBERSHIP_VISIBLE_TRUE; + } + switch ($visibility) { + case OG_MEMBERSHIP_VISIBLE_TRUE: + $default = isset($node->og_selective) ? $node->og_selective : variable_get('og_membership_default', OG_OPEN); + $options = array( + t('Open - membership requests are accepted immediately.'), + t('Moderated - membership requests must be approved.'), + t('Invite only - membership must be created by an administrator.'), + t('Closed - membership is exclusively managed by an administrator.'), + ); + $form['og_selective'] = array( + '#type' => 'radios', + '#title' => t('Membership requests'), + '#required' => TRUE, + '#default_value' => $default, + '#options' => $options, + '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'og_selective') : 0, + '#description' => t('How should membership requests be handled in this group? When you select closed, users will not be able to join or leave.') + ); + break; + case OG_MEMBERSHIP_VISIBLE_FALSE: + $form['og_selective'] = array( + '#type' => 'value', + '#value' => variable_get('og_membership_default', OG_OPEN), + ); + break; + } // registration checkbox // get the visibility for normal users Index: includes/og.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/includes/Attic/og.admin.inc,v retrieving revision 1.15.4.4 diff -u -p -r1.15.4.4 og.admin.inc --- includes/og.admin.inc 20 May 2010 07:54:22 -0000 1.15.4.4 +++ includes/og.admin.inc 13 Jan 2011 13:04:40 -0000 @@ -68,6 +68,33 @@ function og_admin_settings() { '#options' => $options ); + // groups membership requests + $options = array( + OG_MEMBERSHIP_VISIBLE_TRUE => t('Group creator chooses membership request setting.'), + OG_MEMBERSHIP_VISIBLE_FALSE => t('Groups always use default membership request setting.'), + ); + $form['og_settings']['group_details']['og_membership_visible'] = array( + '#type' => 'radios', + '#title' => t('Membership requests control'), + '#default_value' => variable_get('og_membership_visible', OG_MEMBERSHIP_VISIBLE_TRUE), + '#description' =>t('OG admins always see the option for changing group group membership settings. Note that changing this setting will affect existing posts when they are edited.'), + '#options' => $options, + ); + + $options = array( + t('Open - membership requests are accepted immediately.'), + t('Moderated - membership requests must be approved.'), + t('Invite only - membership must be created by an administrator.'), + t('Closed - membership is exclusively managed by an administrator.'), + ); + $form['og_settings']['group_details']['og_membership_default'] = array( + '#type' => 'radios', + '#title' => t('Membership requests default'), + '#default_value' => variable_get('og_membership_default', OG_OPEN), + '#description' => t('How should membership requests be handled by default? When you select closed, users will not be able to join or or leave. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.'), + '#options' => $options, + ); + // audience checkboxes $form['og_settings']['group_details']['og_audience_checkboxes'] = array( '#type' => 'checkbox',