You are here

function simplenews_issue_update_sent_status in Simplenews 7.2

Same name and namespace in other branches
  1. 8 simplenews.module \simplenews_issue_update_sent_status()

Update the sent status of a node.

If the node part of a translation set, all corresponding translations are updated as well.

Parameters

$node: The node object to be updated.

$status: The new status, defaults to SIMPLENEWS_STATUS_SEND_PENDING.

Related topics

2 calls to simplenews_issue_update_sent_status()
simplenews_add_node_to_spool in includes/simplenews.mail.inc
Add the newsletter node to the mail spool.
simplenews_issue_send in includes/simplenews.admin.inc
Callback to send newsletters.

File

./simplenews.module, line 2640
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_issue_update_sent_status($node, $status = SIMPLENEWS_STATUS_SEND_PENDING) {

  // When this node is selected for translation, all translation of this node
  // will be sent too.
  if (module_exists('translation') && translation_supported_type($node->type) && $node->tnid > 0) {
    if ($translations = translation_node_get_translations($node->tnid)) {
      foreach ($translations as $translation) {
        $tnode = node_load($translation->nid);
        simplenews_issue_status($tnode, SIMPLENEWS_STATUS_SEND_PENDING);
        node_save($tnode);
      }
    }
  }
  simplenews_issue_status($node, $status);
  node_save($node);
}