All pastes #425616 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-05 16:22 UTC
rendered paste body
<?php
function custom_form_alter($form_id, &$form) {
print_r($form);
  if ($form_id == 'comment_form' && !custom_user_oneof_owner($node->assign_to, $node->uid, $node->pid)) {
    return drupal_access_denied();
  }
}

function custom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
      if ($node->case_status_id == 6 && !custom_user_oneof_owner($node->assign_to, $node->uid, $node->pid)) {
        return drupal_access_denied();
      }
      break;
  }
}

function custom_user_oneof_owner($aid, $cuid, $pid) {
  global $user;
  $project_node = node_load(array('nid' => $pid));

  if ($user->uid == $project_node->uid || $user->uid == $cuid || $user->uid == $aid || $user->uid == 1) {
    return true;
  }
  else {
    return false;
  }
}