You are here

function og_create_admin_confirm_submit in Organic groups 6

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

Confirm og create admin form

File

./og.module, line 799

Code

function og_create_admin_confirm_submit($form, &$form_state) {
  $account = $form_state['values']['account'];
  $node = $form_state['values']['node'];
  og_save_subscription($node->nid, $account->uid, array(
    'is_admin' => 1,
  ));
  drupal_set_message(t('%name was promoted to <em>group administrator</em>.', array(
    '%name' => $account->name,
  )));
  $variables = array(
    '@group' => $node->title,
    '!group_url' => url("node/{$node->nid}", array(
      'absolute' => TRUE,
    )),
    '@username' => $account->name,
  );
  $message = array(
    'subject' => _og_mail_text('og_new_admin_subject', $variables),
    'body' => _og_mail_text('og_new_admin_body', $variables),
  );
  module_invoke_all('og', 'admin create', $node->nid, $account->uid, $message);
  $form_state['#redirect'] = "og/users/{$node->nid}";
}