You are here

function og_manage_form in Organic groups 5.3

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.7 og.module \og_manage_form()
  5. 6.2 og.pages.inc \og_manage_form()
  6. 6 og.module \og_manage_form()
1 string reference to 'og_manage_form'
og_manage in ./og.module

File

./og.module, line 371

Code

function og_manage_form($group) {
  global $user;

  // avoid double messages on POST
  if (!$_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 %closed group. You should request removal from a group administrator.', array(
        '%closed' => t('closed'),
      )));
    }
    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}");
      $form['unsubscribe'] = array(
        '#type' => 'markup',
        '#value' => theme('item_list', $links),
      );
    }
  }
  $form['gid'] = array(
    '#type' => 'value',
    '#value' => $group->nid,
  );
  return $form;
}