function og_ui_unsubscribe

cis7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)
cle7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)
elmsmedia7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)
icor7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)
meedjum_blog7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)
mooc7 og_ui.pages.inc og_ui_unsubscribe($group_type, $gid)

Confirm OG unsubscription form.

The unsubscribing user is always the acting user - like this we make sure no malicious user will unsubscribe another user. Administrators can reject or ban another group member from the "people" page.

2 string references to 'og_ui_unsubscribe'
og-7.x-1.x.database.php in sites/all/modules/ulmus/og/tests/og-7.x-1.x.database.php
Filled installation of Drupal 7.0, for test purposes.
og_ui_menu in sites/all/modules/ulmus/og/og_ui/og_ui.module
Implements hook_menu().

File

sites/all/modules/ulmus/og/og_ui/og_ui.pages.inc, line 203
Page callbacks for Organic groups module.

Code

function og_ui_unsubscribe($group_type, $gid) {
  global $user;
  $account = clone $user;
  $group = entity_load_single($group_type, $gid);
  if (!$group || !og_is_group($group_type, $group)) {
    // Not a valid entity, or not a group.
    drupal_not_found();
    return;
  }

  // Check the user isn't the manager of the group.
  if ($group->uid != $user->uid) {
    if (og_is_member($group_type, $gid, 'user', $account, array(OG_STATE_ACTIVE, OG_STATE_PENDING))) {
      // Show the user a subscription confirmation.
      return drupal_get_form('og_ui_confirm_unsubscribe', $group_type, $group);
    }
    drupal_access_denied();
    return;
  }
  else {
    $label = entity_label($group_type, $group);
    drupal_set_message(t('As the manager of %group, you can not leave the group.', array('%group' => $label)));

    $url = entity_uri($group_type, $group);
    drupal_goto($url['path'], $url['options']);
  }
}