You are here

function og_invite_form_submit in Organic groups 5.7

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. 6.2 og.pages.inc \og_invite_form_submit()
  6. 6 og.module \og_invite_form_submit()

File

./og.module, line 664

Code

function og_invite_form_submit($form_id, $form_values) {
  $emails = $form_values['valid_emails'];
  $node = node_load($form_values['gid']);
  $variables = array(
    '@group' => $node->title,
    '@description' => $node->og_description,
    '@site' => variable_get('site_name', 'drupal'),
    '!group_url' => url("og/subscribe/{$node->nid}", NULL, NULL, TRUE),
    '@body' => $form_values['pmessage'],
  );
  global $user;
  $from = $user->mail;
  foreach ($emails as $mail) {
    drupal_mail('og_invite_form', $mail, _og_user_mail_text('og_invite_user_subject', $variables), _og_user_mail_text('og_invite_user_body', $variables), $from);
  }
  drupal_set_message(format_plural(count($emails), '1 invitation sent.', '@count invitations sent.'));
}