I haven't yet tried out this module, but took a few minutes to look at the code and have a couple questions.

  1. There are a few places where = &$ is used during variable assignment. I'm guessing that it works, but it looks like these may be artifacts of some copy-and-paste of variable names from the function declarations.
  2. In nodeaccess_userreference_node_access_records(), $var_name, $update_name and $delete_name are all created by doing string concatenation with $field['field_name']. Then, in the if statement below, it looks like the grants array will only be added to if $field['field_name'] is an array. If it's an array, then I'm not sure how the string concatenations would have worked. I probably just need to run through the code, but it seems like nodeaccess_userreference_node_access_records() is going to always return an empty array.

Comments

danielb’s picture

# There are a few places where = &$ is used during variable assignment. I'm guessing that it works, but it looks like these may be artifacts of some copy-and-paste of variable names from the function declarations.

This is usually because I am assigning a reference to a subset of an array, to make it more convenient to code.
If i have some data in $array['someplace']['anotherplace'][3]['#data'] it is too long for me to keep writing this so I do this:
$data = &$array['someplace']['anotherplace'][3]['#data'];
and from now on this information can be accessed through $data - but it is not a copy of the information (as it would be if I left the & out)

In nodeaccess_userreference_node_access_records(), $var_name, $update_name and $delete_name are all created by doing string concatenation with $field['field_name']. Then, in the if statement below, it looks like the grants array will only be added to if $field['field_name'] is an array. If it's an array, then I'm not sure how the string concatenations would have worked. I probably just need to run through the code, but it seems like nodeaccess_userreference_node_access_records() is going to always return an empty array.

There was a bug here I think, I am updating the module today with my latest code which is better tested. You are a clever one for spotting that without ever using the module!!

danielb’s picture

Status: Active » Fixed

Should be good in the new release!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.