og_email_form_submit

Versions
5
og_email_form_submit($form_id, $form_values)

Code

contributions/og/og.module, line 322

<?php
function og_email_form_submit($form_id, $form_values) {
  $node = node_load($form_values[gid]);

  $variables = array(
    '@group' => $node->title,
    '@body' => $form_values['body'],
    '@site' => variable_get('site_name', drupal),
    '!url_group' => url("node/$node->nid", NULL, NULL, TRUE),
    '!url_unsubscribe' => url("og/unsubscribe/$node->nid", NULL, NULL, TRUE)
  );
  
  global $user;
  $from = $user->mail;
  $sql = og_list_users_sql(1);
  $result = db_query($sql, $form_values['gid']);
  while ($row = db_fetch_object($result)) {
     $emails[] = $row->mail;
  }
  foreach ($emails as $mail) {
    drupal_mail('og_mail', trim($mail), $form_values['subject'], _og_user_mail_text('og_admin_email_body', $variables), $from);
  }
  drupal_set_message(format_plural(count($emails), '1 email sent.', '@count emails sent'));
  drupal_goto("node/{$form_values[gid]}");
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.