Is it possible to limit the userreference options to only active users? Also to drop users that go from active to blocked on the display side?

Comments

jmarkantes’s picture

Version: 4.7.x-1.4 » 4.7.x-1.5-1
Status: Active » Needs review

I've run into this also, and was surprised to find this issue still opened with no reply.

With the lastest 1.5-1 installed, userreference was still not noticing blocked or active status. In line 278 of userreference.module I added u.status=1 in the SQL query. So line 278 goes from :

$result = db_query('SELECT u.name, u.uid FROM {users} u LEFT JOIN {users_roles} r ON u.uid = r.uid WHERE u.uid > 0 AND r.rid IN ('. implode($roles, ',') .') ORDER BY u.name ASC');

to:

$result = db_query('SELECT u.name, u.uid FROM {users} u LEFT JOIN {users_roles} r ON u.uid = r.uid WHERE u.uid > 0 AND u.status=1 AND r.rid IN ('. implode($roles, ',') .') ORDER BY u.name ASC');

This raises a couple questions:

1) Should there be an option in the widget setup to differentiate active and/or blocked users? My guess is that sticking with just active users will suffice.

2) How might this affect other content types that rely on userreference, with a user is switched from active to blocked? I haven't dug through the code enough to see. There might be a case where a module has a user reference to a blocked user..

Anyways, hope this code might help.
Jason

rubenk’s picture

subscribing.

this seems fairly important

karens’s picture

Version: 4.7.x-1.5-1 » 5.x-1.x-dev
Status: Needs review » Fixed

Fixed in a different way for 5.x in latest commit by adding an option to select whether blocked or active users, or both, should be included in referenced user lists. Also added to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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