The same electoral list bug exists in the v6 as was in the v5 here: http://drupal.org/node/365338. and here: http://drupal.org/node/363323.

Adding users to the electoral list is not possible as one gets the message "User x does not exist". This happens whether "use electoral list by default" is selected or not, and whether the standard "Poll" Drupal module is active or not.

I looked at the decisions.module, and there are in fact two distinct and unrelated problems (which made investigation difficult):

on line 459:

if (db_fetch_object(db_query('SELECT uid FROM {users} WHERE name="%s"', $add_user)))

The variable %s should be %user, otherwise the user check fails.

It should therefore be this:

if (db_fetch_object(db_query('SELECT uid FROM {users} WHERE name="%user"', $add_user)))

Then, on line 473

db_query('REPLACE INTO {decisions_electoral_list} (nid, uid) SELECT "%d", u.uid FROM users u WHERE u.name = "%s"', $nid, $add_user)

the wrapper for the users table is missing.

It should be like this:

db_query('REPLACE INTO {decisions_electoral_list} (nid, uid) SELECT "%d", u.uid FROM {users} u WHERE u.name = "%s"', $nid, $add_user)

With these changes it works fine.

Comments

anarcat’s picture

Status: Active » Needs work

This needs a proper patch before commit.

anarcat’s picture

Status: Needs work » Fixed

I just fixed this in CVS. The first query was right, but the logic was reversed. The second query was fixed. See also #351491: Administer electoral lists errors: "user [name] does not exist".

Status: Fixed » Closed (fixed)
Issue tags: -user, -electoral list, -decisions.module

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