Duplicate Entry Error When New User First Logins in
| Project: | phplist Integration Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | paulbeaney |
| Status: | closed |
Jump to:
Brief Description
When a new user logs into Drupal for the first time (after ticking the newsletter subscribe during account creation), they receive the following error message:
user warning: Duplicate entry '767-1' for key 1 query: INSERT INTO phplist_listuser(userid, listid, entered) VALUES(767, 1, NOW()) in /srv/data1/www/vhosts/999itstime/test/sites/all/modules/phplist/phplist.module on line 576.
This error does not occur on subsequent logins for that user. For each new user, the value for userid in the error is incremented as expected.
Further Information
I switched on debugging ("DEFINE('PHPLIST_DEBUG', true);" within phplist.module) to see what's happening. I used real email addresses which did not already exist within Drupal or PHPlist, but have changed them to a generic address for reporting purposes.
After creating a Drupal account, the user is added to PHPlist with the ID shown below and all the correct attributes set (including attribute Drupal, which is checked). The following debug info is displayed:
- Synchronised attribute Full Name : Test User
- Found phplistid [768] for email someone@somewhere.tld
- Subscribing 768 to list 1
When this new user logs into Drupal for the first time (using either the one-time login provided in the conformation email, or by directly supplying a username/password), the following debug info is displayed:
- Synchronised attribute Full Name : Test User
- Found phplistid [768] for email someone@somewhere.tld
- Subscribing 768 to list 1
- Synchronised attribute Full Name : Test User
and the following error is then displayed:
user warning: Duplicate entry '768-1' for key 1 query: INSERT INTO phplist_listuser(userid, listid, entered) VALUES(767, 1, NOW()) in /srv/data1/www/vhosts/999itstime/test/sites/all/modules/phplist/phplist.module on line 576.
Version Information
Drupal v6.10
PHPlist Module v1.12.2.19 (2009/03/26)
PHPlist v2.10.9
--
Dominic Search
http://photographicon.com/

#1
Hi photographicon,
A couple of questions please - can you tell me how the user accounts are being created - are the users registering themselves or are they being created by an adminstrator?
Do you have auto-subscribe activated?
Are your user accounts activated instantly or do they require admin approval?
With the answers to these questions, I ought to be able to get to the bottom of the problem quickly.
Regards,
- Paul
#2
Hi Paul,
By themselves... the problem does not happen when the administrator creates the account.
Disabled... the problem also happens when enabled.
The problem does not happen if the user does not subscribe to a list when creating the account... they can later subscribe via "my account", logout and login again without getting the duplicate warning.
Instantly, but require email validation... the problem does not happen when an admin has to approve the account.
Hope this helps :)
--
Dominic Search
http://photographicon.com/
#3
Hi all,
I had the same problem,
I've resolved to change the line 584 in phplist/phplist.module
Before:
if (db_result(db_query("SELECT lid FROM {phplist_access} WHERE lid=%d AND rid IN (%s)", $lid, $roles))) $booOK = true;
After :
if (db_result(db_query("SELECT lid FROM {phplist_access} WHERE lid=%d AND rid IN (%s)", $lid, $roles))) $booOK = false;
Hope this helps someone.
bye
maxi
#4
sorry it's a mistake, doesen't works.
too simple :-)
maxi
#5
Hi,
There is a long-standing problem with the auto-signup which is going to require a day or 2 to really get my head round. I'm not sure when this is going to happen though. Unless someone else has a chunk of time spare to look at it, it's not going to be in the immediate future, much as I would like to be able to drop everything else and concentrate on this. I will get to it as soon as I can...
Regards,
- Paul
#6
Please see latest D6-DEV release uploaded 0915 GMT+2, 8th August 2009. This should fix that problem.
#7
Assuming fixed due to lack of feedback.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.