This code snippet below is how I received the model template. Around line 150 where it checks the isset($model) && $type_name... it was throwing an error there on node save.

function model_access($op, $model = NULL, $account = NULL) {
  if (user_access('administer model', $account)) {
    return TRUE;
  }
  if (isset($model) && $type_name = $model->type) {
    $op = ($op == 'view') ? 'view' : 'edit';
    if (user_access("$op any $type_name model", $account)) {
      return TRUE;
    }
  }
  return FALSE;
}

I changed it below to stop the error. Thought this was note-worthy and would pass it along.

function model_access($op, $model = NULL, $account = NULL) {
  if (user_access('administer model', $account)) {
    return TRUE;
  }
  if (isset($model) && gettype($model) == 'object' && $type_name = $model->type) {
    $op = ($op == 'view') ? 'view' : 'edit';
    if (user_access("$op any $type_name model", $account)) {
      return TRUE;
    }
  }
  return FALSE;
}

Comments

anybody’s picture

Status: Needs review » Needs work

Shell we create a patch and add an is_object() check in hook_access here?