You are here

function og_admin_settings in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.module \og_admin_settings()
  2. 5 og.module \og_admin_settings()
  3. 5.3 og.module \og_admin_settings()
  4. 5.7 og.module \og_admin_settings()
  5. 6.2 includes/og.admin.inc \og_admin_settings()
  6. 6 includes/og.admin.inc \og_admin_settings()
1 string reference to 'og_admin_settings'
og_menu in ./og.module

File

./og.module, line 2303

Code

function og_admin_settings() {
  $form['#submit']['og_settings_submit'] = array();

  // custom submit handler
  $form['#submit']['system_settings_form_submit'] = array();

  // form.inc never calls the $callback if a submit handler is defined
  drupal_set_title(t('Organic groups configuration'));
  if (variable_get('og_enabled', 0)) {
    $status = t('enabled');
    $btn_text = t('Disable');
    $description = t('Before disabling this module, use the button below to restore default permissions.');
  }
  else {
    $status = t('disabled');
    $btn_text = t('Enable');
    $description = t('Enable access control if you want to author any content that is restricted to group members. The button below will delete one record in your node_access table (if needed) and thus enable node permissions on your site. You may revert by clicking the same button again. If you switch back and forth, your node permissions are preserved.');
  }
  $form['og_settings']['og_module_status'] = array(
    '#type' => 'fieldset',
    '#title' => t('Access control'),
    '#description' => $description,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['og_settings']['og_module_status']['module_action'] = array(
    '#type' => 'submit',
    '#value' => $btn_text,
    '#prefix' => '<p>' . t('Organic groups access control is currently %status.', array(
      '%status' => $status,
    )) . '</p>',
  );
  $form['og_settings']['group_details'] = array(
    '#type' => 'fieldset',
    '#title' => t('Group details'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  // groups directory visibility
  $options = array(
    t('New groups don\'t appear in the groups directory. Administrators control the directory exclusively.'),
    t('New groups always appear in the groups directory.'),
    t('Group creator chooses whether her group appears in the directory. Defaults to %in.', array(
      '%in' => t('in directory'),
    )),
    t('Group creator chooses whether her group appears in the directory. Defaults to %out.', array(
      '%out' => t('not in directory'),
    )),
  );
  $form['og_settings']['group_details']['og_visibility_directory'] = array(
    '#type' => 'radios',
    '#title' => t('Groups directory control'),
    '#default_value' => variable_get('og_visibility_directory', OG_DIRECTORY_CHOOSE_TRUE),
    '#description' => t('OG admins always see the checkbox for adding a group to the %dir. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.', array(
      '%dir' => t('groups directory'),
    )),
    '#options' => $options,
  );

  // groups registration visibility
  $options = array(
    t('New groups don\'t appear in on the registration form. Administrators control the form exclusively.'),
    t('New groups always appear on the registration form.'),
    t('Group creator chooses whether her group appears on the registration form. Defaults to %in.', array(
      '%in' => t('on form'),
    )),
    t('Group creator chooses whether her group appears on the registration form. Defaults to %out.', array(
      '%out' => t('not on form'),
    )),
  );
  $form['og_settings']['group_details']['og_visibility_registration'] = array(
    '#type' => 'radios',
    '#title' => t('Registration form control'),
    '#default_value' => variable_get('og_visibility_registration', OG_REGISTRATION_CHOOSE_FALSE),
    '#description' => t('OG admins always see the checkbox for adding a group to the %dir. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.', array(
      '%dir' => t('registration form'),
    )),
    '#options' => $options,
  );

  // email notifications default
  $options = array(
    OG_NOTIFICATION_SELECTIVE => t('New registrants are not subscribed to group email notifications by default. A user may choose to enable this from her profile page or her my subscriptions page.'),
    OG_NOTIFICATION_ALWAYS => t('New registrants are subscribed to group email notifications by default. A user may choose to disable this from her profile page.'),
  );
  $form['og_settings']['group_details']['og_notification'] = array(
    '#type' => 'radios',
    '#title' => t('Group email notifications'),
    '#default_value' => variable_get('og_notification', OG_NOTIFICATION_ALWAYS),
    '#description' => t('Should new registrants automatically be notified via email when new content is posted to their subscribed group? Note that changing this setting has no effect on existing subscriptions.'),
    '#options' => $options,
  );
  $form['og_settings']['node_form'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node authoring form'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['og_settings']['node_form']['og_help'] = array(
    '#type' => 'textarea',
    '#default_value' => variable_get('og_help', ''),
    '#cols' => 70,
    '#rows' => 5,
    '#title' => t('Explanation or submission guidelines'),
    '#description' => t('This text will be displayed at the top of the group submission form.  It is useful for helping or instructing your users.'),
  );
  $form['og_settings']['node_form']['og_audience_checkboxes'] = array(
    '#type' => 'checkbox',
    '#title' => t('Audience checkboxes'),
    '#default_value' => variable_get('og_audience_checkboxes', TRUE),
    '#description' => t('Show each subscribed group as a checkbox in the Audience section. This enables user to place her post into multiple groups. If unchecked, simplify the user interface by omitting the checkboxes and assuming user wants to post into the current group. Group administrators always see checkboxes.'),
  );
  $options = array(
    t('Visible only within the targeted groups'),
    t('Visible within the targeted groups and on other pages'),
    t('Visibility chosen by author/editor using a checkbox on the posting form. ') . t('Checkbox defaults to @pub.', array(
      '@pub' => t('Public'),
    )),
    t('Visibility chosen by author/editor using a checkbox on the posting form. ') . t('Checkbox defaults to @pri.', array(
      '@pri' => t('Private'),
    )),
  );
  $form['og_settings']['node_form']['og_visibility'] = array(
    '#type' => 'radios',
    '#title' => t('Visibility of posts'),
    '#default_value' => variable_get('og_visibility', 0),
    '#description' => t('Determine how broadly available a given post should be when it is affiliated with a group. OG admins always see the checkbox for making a post @pub. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.', array(
      '@pub' => t('Public'),
    )),
    '#options' => $options,
  );
  $options = array(
    t('optional'),
    t('required'),
  );
  $form['og_settings']['node_form']['og_audience_required'] = array(
    '#type' => 'radios',
    '#title' => t('Audience required'),
    '#default_value' => variable_get('og_audience_required', FALSE),
    '#options' => $options,
    '#description' => t('Do you require that all (non administrator) posts be affiliated with a group? Note that changing this setting will affect existing posts when they are edited.'),
  );
  unset($options);
  $types = node_get_types();
  foreach ($types as $type) {
    $options[$type->type] = t($type->name);
  }
  $og_node_type_options = $options;

  // save this for og_node_types
  // hide node types which are already serving as a group node
  foreach (variable_get('og_node_types', array(
    'og',
  )) as $val) {
    unset($options[$val]);
  }
  $form['og_settings']['node_form']['og_omitted'] = array(
    '#type' => 'select',
    '#title' => t('Omitted content types'),
    '#default_value' => variable_get('og_omitted', array()),
    '#options' => $options,
    '#description' => t('Select any node types which should <em>not</em> participate in the Audience targetting system. Node types which are designated as group home page node types (see below) will be automatically excluded.'),
    '#multiple' => TRUE,
  );
  $form['og_settings']['home'] = array(
    '#type' => 'fieldset',
    '#title' => t('Group home page'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $options = og_get_available_views();
  $form['og_settings']['home']['og_home_page_view'] = array(
    '#type' => 'radios',
    '#title' => t('Presentation style'),
    '#options' => $options,
    '#default_value' => variable_get('og_home_page_view', 'og_ghp_ron'),
    '#description' => t('Pick a View for your group home page. Only Views whose names start with <strong>og_ghp_</strong> are eligible. The View determines the layout of your home page. You may alter the presentation using usual the !theme. Also see the Theme section of the OG README file.', array(
      '!theme' => l(t('usual Views themeing techniques'), 'http://drupal.org/node/42597'),
    )),
  );
  $form['og_settings']['home']['og_node_types'] = array(
    '#type' => 'select',
    '#title' => t('Group home page node types'),
    '#default_value' => variable_get('og_node_types', array(
      'og',
    )),
    '#options' => $og_node_type_options,
    '#required' => TRUE,
    '#description' => t("<b>Required</b>. Select the node types which act as group home pages. Usually, you will want to !create called <em>group</em> for this purpose.", array(
      '!create' => l(t('create a simple node type'), 'admin/content/types'),
    )),
    '#multiple' => TRUE,
  );
  $form['og_settings']['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('Email settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['og_settings']['email']['og_new_node_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('New content subject'),
    '#description' => 'Subject of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @body, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.',
    '#default_value' => _og_user_mail_text('og_new_node_subject'),
  );
  $form['og_settings']['email']['og_new_node_body'] = array(
    '#type' => 'textarea',
    '#title' => t('New content body'),
    '#rows' => 10,
    '#description' => 'Body of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @body, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.',
    '#default_value' => _og_user_mail_text('og_new_node_body'),
  );
  $form['og_settings']['email']['og_admin_email_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Group admin email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe',
    '#default_value' => _og_user_mail_text('og_admin_email_body'),
  );
  $form['og_settings']['email']['og_approve_user_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('User approved email subject'),
    '#description' => 'The subject of the email sent to new approved users. Available variables: !group_url, @title',
    '#default_value' => _og_user_mail_text('og_approve_user_subject'),
  );
  $form['og_settings']['email']['og_approve_user_body'] = array(
    '#type' => 'textarea',
    '#title' => t('User approved email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to new approved users. Available variables: !group_url, @title',
    '#default_value' => _og_user_mail_text('og_approve_user_body'),
  );
  $form['og_settings']['email']['og_deny_user_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('User denied email subject'),
    '#description' => 'The subject of the email sent to denied users. Available variables: !group_url, @title',
    '#default_value' => _og_user_mail_text('og_deny_user_subject'),
  );
  $form['og_settings']['email']['og_deny_user_body'] = array(
    '#type' => 'textarea',
    '#title' => t('User denied email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to denied users. Available variables: !group_url, @title',
    '#default_value' => _og_user_mail_text('og_deny_user_body'),
  );
  $form['og_settings']['email']['og_invite_user_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Invite user email subject'),
    '#description' => 'The subject of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body',
    '#default_value' => _og_user_mail_text('og_invite_user_subject'),
  );
  $form['og_settings']['email']['og_invite_user_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Invite user email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body',
    '#default_value' => _og_user_mail_text('og_invite_user_body'),
  );
  $form['og_settings']['email']['og_request_user_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Request user email subject'),
    '#description' => 'The subject of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url',
    '#default_value' => _og_user_mail_text('og_request_user_subject'),
  );
  $form['og_settings']['email']['og_request_user_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Request user email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url',
    '#default_value' => _og_user_mail_text('og_request_user_body'),
  );
  $form['og_settings']['email']['og_new_admin_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('New admin user email subject'),
    '#description' => 'The subject of the email sent to a new admin for a group. Available variables: @group, @username, !group_url',
    '#default_value' => _og_user_mail_text('og_new_admin_subject'),
  );
  $form['og_settings']['email']['og_new_admin_body'] = array(
    '#type' => 'textarea',
    '#title' => t('New admin user email body'),
    '#rows' => 10,
    '#description' => 'The body of the email sent to a new admin for a group. Available variables: @group, @username, !group_url, !invite_url',
    '#default_value' => _og_user_mail_text('og_new_admin_body'),
  );
  $form['og_settings']['pictures'] = array(
    '#type' => 'fieldset',
    '#title' => t('Member pictures'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['og_settings']['pictures']['og_member_pics'] = array(
    '#type' => 'checkbox',
    '#title' => t('Member pictures'),
    '#default_value' => variable_get('og_member_pics', TRUE),
    '#description' => t('Should member pictures be shown in the group subscribers and group details blocks? You must also enable pictures in !user.', array(
      '!user' => l(t('User configuration'), 'admin/user/settings'),
    )),
  );
  return system_settings_form($form);
}