You are here

function mass_contact_save_node in Mass Contact 5

Save the sent mail as a node.

1 call to mass_contact_save_node()
mass_contact_mail_page_submit in ./mass_contact.module
Process the mail page form submission.

File

./mass_contact.module, line 690
Enables mass contact form to selected roles.

Code

function mass_contact_save_node($subject, $body, $recipients, $category, $roles, $uid) {

  // get role names
  foreach ($roles as $r) {
    $roletemp = db_fetch_object(db_query("SELECT name FROM {role} WHERE rid = %d", $r));
    $rolesenta[] = $roletemp->name;
  }
  $rolesent = implode(', ', $rolesenta);
  $node->title = $subject;
  $node->body = '<p><i>' . t('Category: ') . $category . '</i><p><i>' . t('Roles: ') . $rolesent . '</i><p><i>' . t('Recipients: ') . $recipients . '</i><p>' . $body;
  $node->teaser = node_teaser($node->body);
  $node->type = 'mass_contact';
  $node->uid = $uid;
  $node->format = 3;
  $node->status = 0;
  $node->comment = 2;
  $node->promote = 0;
  $node->sticky = 0;
  node_save($node);
  return TRUE;
}