You are here

function view_unpublished_nodeapi in view_unpublished 5

File

./view_unpublished.module, line 61

Code

function view_unpublished_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'update':
      if (is_numeric(arg(1)) && arg(0) == 'node' && arg(2) == 'edit' && user_access('use view_unpublished module') && !user_access('administer nodes')) {

        // If node successfully edited, then go to node view: http://drupal.org/node/301221
        if ($node->status == 0 && (user_access('view unpublished ' . $node->type . ' content') || user_access('view all unpublished content'))) {
          drupal_goto("node/{$node->nid}");
        }
      }
      break;
  }
}