You are here

function simplenews_node_access in Simplenews 7.2

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_node_access()
  2. 8 simplenews.module \simplenews_node_access()
  3. 7 simplenews.module \simplenews_node_access()
  4. 3.x simplenews.module \simplenews_node_access()

Implements hook_node_access().

Don't allow deletion when a newsletter is pending

File

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

Code

function simplenews_node_access($node, $op, $account) {
  if ($op == 'delete') {

    // Check if a newsletter is pending
    if (simplenews_issue_status($node) == SIMPLENEWS_STATUS_SEND_PENDING) {
      drupal_set_message(t('You can\'t delete this newsletter because it has not been sent to all its subscribers.'), 'warning');
      return NODE_ACCESS_DENY;
    }
  }
  return NODE_ACCESS_IGNORE;
}