You are here

function og_invite_form_submit in Organic groups 6

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

File

./og.module, line 915

Code

function og_invite_form_submit($form, &$form_state) {
  $emails = $form_state['valid_emails'];
  $node = node_load($form_state['values']['gid']);
  $variables = array(
    '@group' => $node->title,
    '@description' => $node->og_description,
    '@site' => variable_get('site_name', 'drupal'),
    '!group_url' => url("og/subscribe/{$node->nid}", array(
      'absolute' => TRUE,
    )),
    '@body' => $form_state['values']['pmessage'],
  );
  global $user;
  $from = $user->mail;
  foreach ($emails as $mail) {
    drupal_mail('og', 'invite_user', $mail, $GLOBALS['language'], $variables, $from);
  }
  drupal_set_message(format_plural(count($emails), '1 invitation sent.', '@count invitations sent.'));
}