The checkbox in the widget settings doesn't keep nor does the autcomplete include blocked users.

Perhaps due the fact the value for blocked is 0 and there's any array filter around line 75 and around 792 that completely strips the "yo man, blocked's okay" from the the referenceable_status setting.

Sorry if this is a repeat issue

CommentFileSizeAuthor
#9 userreference-416134-9.patch3.83 KBmarkus_petrux
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

petrescs’s picture

subscribing - checking Blocked status box is not saved, only the default marked Active checkbox is preserved

aharown07’s picture

Also having this problem. We would like very much to be able to reference blocked users when we write our user histories. Anybody got patch ideas? Beyond my skills unfortunately.

aharown07’s picture

Version: 6.x-2.2 » 6.x-2.3

Workaround: if you have Views, a View that includes both blocked and unblocked does work as the source for the user ref field... just make the View then choose it under Advanced.
Still a bug though since there's a checkbox there that doesn't work.

hefox’s picture

An easy but wonky way:
1) make a a define('BLOCKED_USER_VALUE',2) or maybe 'blocked'.
2) in the form have BLOCKED_USER_VALUE instead of 0 as the key
3) Replace BLOCKED_USER_VALUE with 0 for DB call.
(Don't have the code in front of me so no line numbers. but using above step 2 was probably line 75 and step 3 was probably line 792).

ize’s picture

Version: 6.x-2.3 » 6.x-2.5

subscribe

markus_petrux’s picture

Status: Needs review » Active

Probably the user status option would have to be converted into a 'radios' element with the following options:

array(
  '' => t('All users'),
  1 => t('Active users'),
  0 => t('Blocked users'),
)

To do so, we need to change a little the code in userreference.module, but also implement a new hook_update_N() function to migrate the field settings to the new format (from array() to integer).

If Active or Blocked has been selected can be checked using is_numeric().

DarrellDuane’s picture

also having this problem, subscribe. I'd like to import legacy data that references blocked users and node import is blocking me from doing this.

DarrellDuane’s picture

As a workaround for this issue, I exported the CCK definition, searched for the UID field and edited the section referenceable_status so that it appears as below (I changed 0 => 0, to be 0 => 1).
I then deleted the CCK type and imported the edited definition. This User Reference field now accepts both blocked and unblocked users.

'referenceable_status' =>
array (
1 => 1,
0 => 1,
),

markus_petrux’s picture

Status: Active » Needs review
FileSize
3.83 KB

Attached patch proceeds as described in #6. Requires running update.php

Please test and let me know if this approach worked. Thanks

markus_petrux’s picture

Title: Userreference, blocked user » Userreference, impossible to filter allowed values by blocked users
Status: Active » Needs review

Better title. :P

markus_petrux’s picture

Status: Needs review » Fixed

Committed the patch in #9 to CVS (branches CCK2 and CCK3).

Status: Fixed » Closed (fixed)

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