I am getting the following runtime error when my custom module tries to render a node edit form:

Notice: Trying to get property of non-object in panels_node_node_access() (line 163 of /var/www/drupal-7.20/sites/all/modules/panels/panels_node/panels_node.module).

It is complaining about this section:

  if ($op == 'update' && (user_access('edit any panel-nodes', $account) || $node->uid == $account->uid && user_access('edit own panel-nodes', $account))) {
    return NODE_ACCESS_ALLOW;
  }

After some debugging, it turns out that $node is not a real node, it is a string (the value is the content type).

I've hacked the module to temporarily fix this problem for us but I hope this will be fixed in future releases:

  if ( gettype ( $node ) == "object" )
    if ($op == 'update' && (user_access('edit any panel-nodes', $account) || $no
de->uid == $account->uid && user_access('edit own panel-nodes', $account))) {
      return NODE_ACCESS_ALLOW;
    }
  else    if ($op == 'delete' && user_access('delete any panel-nodes')) {
      return NODE_ACCESS_ALLOW;
    }
}

Comments

joelpittet’s picture

Title: Notice: Trying to get property of non-object in panels_node_node_access() (line 163 of /var/www/drupal-7.20/sites/all/modules/panels/panels_node/panels_node.module) » Notice: Trying to get property of non-object in panels_node.module