You are here

function og_manage_form in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og.module \og_manage_form()
  2. 5 og.module \og_manage_form()
  3. 5.2 og.module \og_manage_form()
  4. 5.3 og.module \og_manage_form()
  5. 5.7 og.module \og_manage_form()
  6. 6.2 og.pages.inc \og_manage_form()
1 string reference to 'og_manage_form'
og_manage in ./og.module

File

./og.module, line 664

Code

function og_manage_form($form_state, $group) {
  global $user;

  // avoid double messages on form submit
  if (!$form_state['post']) {

    // group manager can't leave
    if ($group->og_selective == OG_CLOSED) {
      drupal_set_message(t('You may not leave this group because it is a <em>closed</em> group. You should request removal from a group administrator.'));
    }
    elseif ($group->uid == $user->uid) {
      drupal_set_message(t('You may not leave this group because you are its owner. A site administrator can assign ownership to another user and then you may leave.'));
    }
    else {
      $links[] = l(t('Leave this group'), "og/unsubscribe/{$group->nid}/{$user->uid}");
      $form['unsubscribe'] = array(
        '#value' => theme('item_list', $links),
      );
    }
  }
  $form['gid'] = array(
    '#type' => 'value',
    '#value' => $group->nid,
  );
  return $form;
}