Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
While debugging this notice:
Notice: Undefined index: uid in nodeaccess_insert_user_reference() (line 937 of nodeaccess/nodeaccess.module).
I realized the values from field_get_items()
return in this format:
$user_uids = [
'0' => ['uid' => 12345],
'1' => ['uid' => 12346],
]
and user_load_multiple()
expects them to be:
$user_uids = [
'0' => 12345,
'1' => 12346,
]
Proposed resolution
Flatten the multidimentional field array.
Comment | File | Size | Author |
---|---|---|---|
#2 | user_reference_grants-2621540-2.patch | 1.19 KB | joelpittet |
Comments
Comment #2
joelpittetComment #3
joelpittet