the 'Blocked' checkbox under the "User status that can be referenced" field setting does not take.
That's most probably because the associated value is 0.

There was a long standing core issue about that, and I thought this was finally fixed. I can't seem to find it right now, though...

#7 references_allow_referencing_blocked_users-1038102-7.patch614 bytesdtarc
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View


andypost’s picture

Confirm this. as I remember there was 2-3 issues with '0' values of radios checkboxes but all been fixed in core...

suppose issue related to current implementation...

fgm’s picture

Status: Active » Needs review
1.78 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View

Replaced the use of 0 and 1 by string values to avoid falling in this type of bug.

fgm’s picture

Status: Needs review » Needs work

As possibly faster solution was suggested by dereine, using a '-0' option instead of '0' and fixing up the value in submit. Then there is no need for the conversion loop in the suggested patch.

And, of course, we need a test to validate the changes.

yched’s picture

Agreed, I'd favor a workaround strictly contained within FAPI processing, without changing the semantics of the stored values.

Also (minor) : if both checkboxes are checked, no need to add anything to the query.

rt_davies’s picture


bocaj’s picture

Changing line 91 in user_reference.module from:

'#options' => array(1 => t('Active'), 0 => t('Blocked')),


'#options' => array(1 => t('Active'), '-0' => t('Blocked')),

worked for me. Not sure that it's the best way to handle it, but now it functions like I expected!

dtarc’s picture

Status: Needs work » Needs review
614 bytes
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View

The suggestion in #6 worked for me, here's a patch.

andypost’s picture

I think using '-0' should have (int) in

- $query->condition('u.status', $field['settings']['referenceable_status']);
+ $query->condition('u.status', (int) $field['settings']['referenceable_status']);
alanburke’s picture

I don't think this matters anymore - I don't seem to have the issue in any case

presleyd’s picture

Problem still exists in 2.1 perhaps it was fixed in dev? Patch in 7 still works in 2.1 though.

MantasK’s picture

Issue summary: View changes
1.06 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch references_allow_referencing_blocked_users-1038102-11_0.patch. Unable to apply patch. See the log in the details link for more information. View

as it is not fixed, one more patch :)

Status: Needs review » Needs work

The last submitted patch, 11: references_allow_referencing_blocked_users-1038102-11.patch, failed testing.

fullerja’s picture

Patch in #7 worked well for me