PHPlist Module does not delete users from PHPlist

photographicon - April 8, 2009 - 13:11
Project:phplist Integration Module
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Brief Description

When a user is deleted from Drupal, they are not deleted from PHPlist because the conditional code that does the deletion never runs. Forcing the code to run does delete the user from PHPlist, but also produces the following error in Drupal:

user warning: Unknown column 'userid' in 'where clause' query: DELETE FROM phplist_user_attribute WHERE userid = 812 in /srv/data1/www/vhosts/999itstime/test/sites/all/modules/phplist/phplist.module on line 462.

Further Information

The conditional test in the following code fragment (starting line 453) always passes, so skips the PHPlist deletion (clearing the Drupal flag instead):

if (true) {
// Just remove the Drupal flag from the phpList account
_phplist_update_attribute('Drupal', 'checkbox', 'off', $phplistid);
}
else {
db_set_active('phplist');

Forcing the condition to 'false' executes the delete code, which seems to work but produces the above error. Only an administrator will see this error, so it is a low-priority cosmetic issue (for me at least :) However it would be more functionally useful to either have the condition test false in the standard code base, or better still to do a real test (perhaps against an admin settable option).

Version Information

Drupal v6.10
PHPlist Module v1.12.2.19 (2009/03/26)
PHPlist v2.10.9

--
Dominic Search
http://photographicon.com/

#1

photographicon - April 10, 2009 - 01:49

Paul, I've found and fixed the reason for the warning message. Line 462:

db_query("DELETE FROM %s WHERE userid = %d", $prefix['user']."attribute", $phplistid);

is missing a "user_" from the table name "phplist_user_user_attribute", so should be:

db_query("DELETE FROM %s WHERE userid = %d", $prefix['user']."user_attribute", $phplistid);

That just leaves the permanently true test condition to deal with... :)

#2

paulbeaney - April 11, 2009 - 08:08
Category:bug report» feature request

Hi,

Changing the status as the module never actually claims to delete the user from PHPlist on deletion ;-) Thanks for your code - I'll put it into the DEV version in the next few days.

Regards,

- Paul

#3

photographicon - April 11, 2009 - 18:26

Changing the status as the module never actually claims to delete the user from PHPlist on deletion ;-)

Good point :)

 
 

Drupal is a registered trademark of Dries Buytaert.