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/

Comments

paulbeaney’s picture

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

photographicon’s picture

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/

maxi’s picture

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

maxi’s picture

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

maxi

paulbeaney’s picture

Assigned: Unassigned » 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

paulbeaney’s picture

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

paulbeaney’s picture

Status: Active » Fixed

Assuming fixed due to lack of feedback.

Status: Fixed » Closed (fixed)

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

mightyulysses’s picture

Status: Closed (fixed) » Active

Hi, I'm afraid this issue is still present. I've downloaded latest dev version of the module. It occurs if a user has signed up to a newsletter prior to registering.

mightyulysses’s picture

This is the error message:

* user warning: Duplicate entry '61-3' for key 1 query: INSERT INTO phplist_listuser(userid, listid, entered) VALUES(61, 3, NOW()) in /var/www/vhosts/default/htdocs/sites/all/modules/phplist/phplist.module on line 638.
* warning: Invalid argument supplied for foreach() in /var/www/vhosts/default/htdocs/sites/all/modules/phplist/phplist.module on line 482.

paulbeaney’s picture