When no role is selected for available users filtering. Instead of displaying all users, no-one is available.
In user_reference.module while building query in _user_reference_potential_references_standard(), the user role filter setting test always return true for the following condition : !in_array(DRUPAL_AUTHENTICATED_RID, $field['settings']['referenceable_roles']).
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | user_reference.module.patch | 1002 bytes | JulienD |
| #3 | user_reference.module.patch | 1.15 KB | JulienD |
| #1 | user_reference.module.patch | 920 bytes | JulienD |
Comments
Comment #1
JulienD commentedHere's a .patch file to solve the fact that no results are returned in the user_reference field when no roles are selected in the field settings.
I just used a "array_filter" on the field user_reference to exclude empty results.
Comment #2
fgmWith the patch in #1, $roles is being assigned twice in a row without change: the first assignment is therefore useless.
And it does not apply because you rolled it in references/node_reference instead of references/
Comment #3
JulienD commentedI updated my patch to allow it to be applied from the root of the module and I removed the first declaration of $roles as suggested in #2.
Comment #4
fgmYou don't really want to leave a dpq() in the patch, do you ? ;-)
Comment #5
JulienD commentedEven if the dpq() is really useful, I agree this function should not be there. My cold has a bad impact on my attention. Sorry
Comment #6
JulienD commentedComment #7
fgmCool, now can we have a test with that ?