Fix for Code

  1. <?php
  2.  
  3. function casetracker_basic_case_access($op, $node) {
  4.   global $user;
  5.  
  6.   switch ($op) {
  7.     case 'view':
  8.       // we have to check if the OG module is installed, otherwise this will
  9.       // overule the OG nodeaccess
  10.       if (!module_exists('og')) {
  11.         return user_access('access case tracker');
  12.       }
  13.       // we check if the case isn't created by the current user or is
  14.       // assigned to the current user, if so that user gets access
  15.       elseif (
  16.         user_access('access case tracker')
  17.         && 0 < (int)$user->uid
  18.         && ((int)$node->casetracker->assign_to === (int)$user->uid
  19.            || (int)$node->uid === (int)$user->uid)
  20.       ) {
  21.         return TRUE;
  22.       }
  23.       break;
  24.     case 'create':
  25.       return user_access('create cases');
  26.     case 'update':
  27.     case 'delete':
  28.       if (user_access('edit own cases') && ($user->uid == $node->uid)) {
  29.         return TRUE;
  30.       }
  31.       break;
  32.   }
  33. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.