You are here

function og_email_form in Organic groups 5.7

Same name and namespace in other branches
  1. 5 og.module \og_email_form()
  2. 5.2 og.module \og_email_form()

Admins may broadcast email to all their members

Parameters

$gid: the nid of a group.

1 string reference to 'og_email_form'
og_menu in ./og.module

File

./og.module, line 304

Code

function og_email_form($gid) {
  $node = node_load($gid);
  drupal_set_title(t('Send email to %group', array(
    '%group' => $node->title,
  )));
  $result = db_query(og_list_users_sql(1), $gid);
  $txt = format_plural(db_num_rows($result), 'the sole member', 'all @count members');
  if (!$_POST) {
    drupal_set_message(t('Your email will be sent to !count in this group. Please use this feature sparingly.', array(
      '!count' => l($txt, "og/users/{$gid}"),
    )));
  }
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#size' => 70,
    '#maxlength' => 250,
    '#description' => t("Enter a subject for your email."),
    '#required' => true,
  );
  $form['body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#rows' => 5,
    '#cols' => 90,
    '#description' => t('Enter a body for your email.'),
    '#required' => true,
  );
  $form['send'] = array(
    '#type' => 'submit',
    '#value' => t('Send email'),
  );
  $form['gid'] = array(
    '#type' => 'value',
    '#value' => $gid,
  );
  return $form;
}