You are here

function simplenews_scheduler_clone_node in Simplenews Scheduler 7

Same name and namespace in other branches
  1. 8 simplenews_scheduler.module \simplenews_scheduler_clone_node()
  2. 2.0.x simplenews_scheduler.module \simplenews_scheduler_clone_node()

Function clones a node from the given template newsletter node.

1 call to simplenews_scheduler_clone_node()
_simplenews_scheduler_new_edition in ./simplenews_scheduler.module
Create a new newsletter edition based on the master edition of this newsletter.

File

./simplenews_scheduler.module, line 566
Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.

Code

function simplenews_scheduler_clone_node($node) {
  if (isset($node->nid)) {
    $clone = clone $node;
    $clone->nid = NULL;
    $clone->vid = NULL;
    $clone->tnid = NULL;
    $clone->created = NULL;
    $clone->book['mlid'] = NULL;
    $clone->path = NULL;

    //$clone->title = $original_node->title;

    // Add an extra property as a flag.
    $clone->clone_from_original_nid = $node->nid;
    node_save($clone);
    return $clone;
  }
}