Needs work
Project:
Model Entities
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Apr 2014 at 15:21 UTC
Updated:
21 Jul 2015 at 14:39 UTC
Jump to comment: Most recent
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
Comment #1
anybodyShell we create a patch and add an is_object() check in hook_access here?