Duplicate Entry Error When New User First Logins in

photographicon - April 5, 2009 - 20:46
Project:phplist Integration Module
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:paulbeaney
Status:closed
Description

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

paulbeaney - April 7, 2009 - 09:32

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

photographicon - April 7, 2009 - 18:30

Hi Paul,

how the user accounts are being created - are the users registering themselves or are they being created by an adminstrator?

By themselves... the problem does not happen when the administrator creates the account.

Do you have auto-subscribe activated?

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.

Are your user accounts activated instantly or do they require admin approval?

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

maxi - July 30, 2009 - 13:38

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

maxi - July 30, 2009 - 14:01

sorry it's a mistake, doesen't works.
too simple :-)

maxi

#5

paulbeaney - August 2, 2009 - 15:53
Assigned to:Anonymous» paulbeaney

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

paulbeaney - August 8, 2009 - 07:16

Please see latest D6-DEV release uploaded 0915 GMT+2, 8th August 2009. This should fix that problem.

#7

paulbeaney - October 29, 2009 - 10:05
Status:active» fixed

Assuming fixed due to lack of feedback.

#8

System Message - November 12, 2009 - 10:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.