You are here

function gom_create_content in Devel 5

1 call to gom_create_content()
generate-og2list-mail.php in generate/generate-og2list-mail.php

File

generate/generate-og2list-mail.php, line 31

Code

function gom_create_content($groups) {
  foreach ($groups as $nid => $group) {
    foreach ($group['users'] as $user) {
      $msg_id = '<' . time() . '.' . mt_rand() . '@' . strtolower(variable_get('og2list_domain', $_SERVER['SERVER_NAME'])) . '>';
      $subject = 'Test mail from ' . $user['name'] . ' to ' . $group['recipient'];
      db_query("INSERT INTO {og2list_incoming_content} (from_address,from_name,subject,msgid,content_type,body) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $user['mail'], $user['name'], $subject, $msg_id, 'text/plain', "totally irrelevant message body, sent at " . format_date(time(), 'custom', t('Y/m/d - G:i')));
      db_query("INSERT INTO {og2list_incoming_groups} SET mid=(SELECT mid FROM {og2list_incoming_content} WHERE msgid='%s'), oid=(SELECT nid FROM {og2list_groups} WHERE recipient='%s')", $msg_id, $group['recipient']);
    }
  }
}