You are here

function simplenews_nodeapi in Simplenews 5

Same name and namespace in other branches
  1. 6.2 simplenews.module \simplenews_nodeapi()
  2. 6 simplenews.module \simplenews_nodeapi()

Implementation of hook_nodeapi().

File

./simplenews.module, line 444

Code

function simplenews_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($node->type == 'simplenews' && ($op == 'update' || $op == 'insert')) {
    if ($node->send == 1) {
      _simplenews_send(TRUE);
      drupal_set_message(t('Newsletter %newsletter is being sent', array(
        '%newsletter' => $node->title,
      )));
    }
    elseif ($node->send == 2) {
      simplenews_send_test($node);
    }
  }
}