"If you would like to have a different email address subscribed, change your email address in the account settings tab."

This feature doesn't appear to be working properly. Does anyone else running version 5 have this problem?

CommentFileSizeAuthor
#6 unsubscribe_old_email.patch4.2 KBarturoramos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daddison’s picture

This is the experience I have with the 4.7.x version of the Mailman Manager module, too. Changing one's email address under account settings has no effect on the address that is subscribed to mailman lists managed by the module. This is a potentially confusing issue for my site's users, and a source of aggravation for me.

I wasn't sure if this is a bug or a "feature," but either way it sounds like it hasn't been addressed in the 5.x version.

Can someone clarify whether the module (version 4.7.x, version 5.x, or both) is designed to update a list when a user who is subscribed to that list changes his/her email under account settings?

Blitter’s picture

Title: Changing user's email under account settings doesn't change it in mailman » Lets do it

I'm happy to have a bash at this one. The first question is what on earth does the current lmail field in the mailman_users table get used for? It gets set to the users current email address when they create a new subscription and then seems to be never used again, instead $account->mail is passed off to the functions. The obvious route would be the after_update $op in hook_user, check here if the lmail field is equal to $account->mail, if not then flush all subscriptions, resubscribe, and update the lmail field.

Blitter’s picture

Title: Lets do it » Changing user's email under account settings doesn't change it in mailman

Goof !!one!11!eleven!!!1

samuelet’s picture

My module at http://drupal.org/project/user_mailman_register implements this way.
Peraphs its code could help you with your issue.

arturoramos’s picture

Yes the lmail field in the mailman_users table was originally intended for what you describe. In the original code for 4.6 this function was operational as I have that version installed on a site and it is functional. The code is as follows:

      foreach ($lists as $list){
        $subscrip=_mailman_manager_get_subscriptions($account->uid,$list[lid]);
        //Reset subscriptions to unsubscribed if user has changed email;
        if ($subscrip[lmail] != $account->mail && $subscrip[lmail] != '') {
          $query = "UPDATE {mailman_users} SET lstatus = %d, lmail = '%s', lpass = '%s' WHERE uid = %d AND lid = %d";
          db_query($query,$lstatus,'','',$account->uid,$list[lid]);
          $command = "unsubscribe ".$subscrip[lpass]." address=".$subscrip[lmail];
          _mailman_manager_setdelivery($account->uid, $list[lid], $subscrip[lmail], $command);	
          $watchdog = 'Subscriptions for user '.$account->uid.' reset do to email change.  Unsubscribed from list '.$list[lid];
          watchdog('mailman man', $watchdog, 'WATCHDOG_NOTICE', NULL);
          $subscrip[lstatus]=0;
		}
arturoramos’s picture

Assigned: Unassigned » arturoramos
Status: Active » Needs review
FileSize
4.2 KB

Attached is a patch that resolves the issue with email addresses not being unsubscribed when email address is changed.

The one thing I cannot figure out is how to pass a message to the user that their old email address has been unsubscribed.

Can someone please install and test and let me know if this is ready to be committed?

arturoramos’s picture

Version: 5.x-1.x-dev » 5.x-1.0
Status: Needs review » Active

This bug being changed to the 5.x-1.0 version since the patch is against that version of the module.

sbandyopadhyay’s picture

I apologize I did not test your patch-- samuelet's module solved the problem quite well. You two should try to combine these projects into one-- both modules are fantastic!!

daddison’s picture

I can report that the patch does work on the 5.x-1.0 code, but not on the 5.x-1.1 version currently available. The patched module will remove an old address from the Mailman list if the user changes his main email address under Account Settings. But as arturoramos indicates, there is no message to the user that this has happened. To get back on the list, the user has to re-subscribe.

arturoramos’s picture

The current 5.x-1.1 version includes the patch so there is no need to patch that.

Thanks for testing the patch against the older version.

I would appreciate someone troubleshooting how to get a message passed to through the user module to the user that her subscriptions have been cancelled due to the email address change. I think this is a pretty important function as otherwise the user may not realize that they need to subscribe their new email address to the lists.

samuelet’s picture

Status: Active » Needs work

it seems to me that this patch is not applied against 5.x-1.1 or something else cvs release.
If i'm right, i could consider to port it in the current 5.x release after reviewing.
About the message, i think that the drupal message mechanism of drupal_set_message could be ok.

davidbessler’s picture

Can anyone confirm that this feature works in 6.x? To be clear, when a user changes his/her email address in drupal, the subscribed address is changed in Mailman.