Electoral list still not working

vfwh - June 24, 2009 - 09:23
Project:Decisions
Version:6.x-0.1-beta3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Issue tags:decisions.module, electoral list, user
Description

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.

#1

anarcat - July 27, 2009 - 21:45
Status:active» needs work

This needs a proper patch before commit.

#2

anarcat - July 27, 2009 - 23:30
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".

#3

System Message - August 10, 2009 - 23:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.