My webpage uses i18n, and there is additional translate tab on node pages. When you try to access it, when no translations exists yet for the node, the following warning occurs:

 Illegal offset type in isset or empty in nodeaccess_userreference_field_settings() (line 388 of (...)/sites/all/modules/nodeaccess_userreference/nodeaccess_userreference.module).

Comments

mariusz.slonina’s picture

The warning raises when nodeaccess_userreference_node_access() is called from node_access in i18n/i18n_node module (i18n_node.pages.inc line 81). If I change

node_access('create', $node);

to

node_access('update', $node);

the warning goes away. Is it the issue of the nodeaccess_userreference or i18n?

danielb’s picture

Hmm this might have to do with some recent additions regarding 'create' functionality. I need to debug the workflow of that.

danielb’s picture

Actually I think i18n is doing the wrong thing. It is calling node_access('create', $node) rather than node_access('create', 'node type');
Not sure they're allowed to do that :/

mariusz.slonina’s picture

Status: Active » Closed (duplicate)

I will mark this for now as duplicate, I posted separate issue on i18n queue #1262800: node_access in i18n_node: ('create', $node) or ('create', $node->type) or ('update', $node).

kdub’s picture

I've also has this issue. But it appears to be site wide. If I preview any newly created node, I receive that same "Warning: Illegal offset type in isset or empty in nodeaccess_userreference_field_settings()" above my previewed content. I'm on D7.8

hbergin’s picture

kdub, I was just debugging the same issue you're having when I saw your post. I'm using D7.9. I've only seen the error when:

  1. I preview a node (whether it is newly created or not)
  2. the user does not have the admin role
hbergin’s picture

As a workaround, I've made the following edits to the module file at line 387 for me, which seem to stop the error being displayed, with no side effects I can see.

//ORIGINAL CODE
/*
  elseif (isset($data[$bundle_name])) {
    return $data[$bundle_name];
  }
*/

//REVISED CODE
  elseif (is_string($bundle_name)) {
    if (isset($data[$bundle_name])) {
    return $data[$bundle_name];
    }
  }
kdub’s picture

Thank you hbergin. That did the trick!

Jaapx’s picture

Solution also works for me in today'sdev version of the module (to be patched in line 424). The problem occured with preview on for the nodetype.

adelka’s picture

Great solution! Thank you!

ryoken’s picture

kdub, I was just debugging the same issue you're having when I saw your post. I'm using D7.9. I've only seen the error when:

1. I preview a node (whether it is newly created or not)
2. the user does not have the admin role

Ditto hbergin, and thank you for identifying the problem and providing the workaround - I've been pulling my hair out until I came across your post. For the record, I'm currently running D7.14 with NAUR 7.x-3.8 (but don't have any internationalisation modules installed).