You are here

function spaces_og_user_groups_form in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 spaces_og/spaces_og.pages.inc \spaces_og_user_groups_form()
  2. 6.2 spaces_og/spaces_og.module \spaces_og_user_groups_form()
  3. 7 spaces_og/spaces_og.pages.inc \spaces_og_user_groups_form()

Form for modifying a user's OG subscriptions quickly.

1 string reference to 'spaces_og_user_groups_form'
spaces_og_menu in spaces_og/spaces_og.module
Implements hook_menu().

File

spaces_og/spaces_og.pages.inc, line 6

Code

function spaces_og_user_groups_form($form, $form_state, $account) {
  $form = og_user('register', array(), $account, $category = NULL);
  $form['og_register']['og_register']['#default_value'] = array_keys($account->og_groups);

  // Don't display as a fieldset
  unset($form['og_register']['#type']);
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  if (!empty($form['og_register']['og_register']['#options'])) {
    $form['buttons'] = array(
      '#tree' => FALSE,
    );
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  else {
    $form['messages'] = array(
      '#type' => 'item',
      '#value' => t('No groups found.'),
    );
  }
  return $form;
}