You are here

function og_confirm_unsubscribe in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og.module \og_confirm_unsubscribe()
  2. 5 og.module \og_confirm_unsubscribe()
  3. 5.2 og.module \og_confirm_unsubscribe()
  4. 5.3 og.module \og_confirm_unsubscribe()
  5. 5.7 og.module \og_confirm_unsubscribe()
  6. 6 og.module \og_confirm_unsubscribe()

Confirm og unsubscription form

1 string reference to 'og_confirm_unsubscribe'
og_menu in ./og.module
Implementation of hook_menu().

File

./og.pages.inc, line 363
Page callbacks for Organic groups.

Code

function og_confirm_unsubscribe($form_state, $group_node, $account) {
  global $user;
  $form['group_node'] = array(
    '#type' => 'value',
    '#value' => $group_node,
  );
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  if ($account->uid == $user->uid) {
    $message = t('Are you sure you want to leave the group %title?', array(
      '%title' => $group_node->title,
    ));
    $confirm_text = t("Leave");
  }
  else {
    $message = t('Are you sure you want to remove !name from the group %title?', array(
      '!name' => theme('username', $account),
      '%title' => $group_node->title,
    ));
    $confirm_text = t("Remove");
  }

  // Set the cancel destination, checking for an existing destination in the URL.
  $destination = isset($_GET['destination']) ? urldecode($_GET['destination']) : 'og/users/' . $group_node->nid;
  return confirm_form($form, $message, $destination, ' ', $confirm_text, t('Cancel'));
}