You are here

function og_subscribe_user_action_form in Organic groups 6.2

Same name and namespace in other branches
  1. 6 modules/og_actions/og_actions.module \og_subscribe_user_action_form()

Configuration form for Add User action.

File

modules/og_actions/og_actions.module, line 260

Code

function og_subscribe_user_action_form($context) {
  $form = array();
  if (!isset($context['groups'])) {
    $context['groups'] = array();
  }
  $groups = og_all_groups_options();
  if (count($groups)) {
    $form['groups'] = array(
      '#type' => 'select',
      '#title' => t('Groups'),
      '#options' => $groups,
      '#description' => t('Select the groups to which this user should be subscribed.'),
      '#default_value' => $context['groups'],
      '#required' => TRUE,
      '#multiple' => TRUE,
    );
  }
  else {
    drupal_set_message(t('Please <a href="!url">create</a> a group first.', array(
      '!url' => url('admin/content'),
    )));
  }
  return $form;
}