Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The email received by subscribers contains a link to unsubscribe which doesn't work; it leads to a "sorry, there was a problem." error. According to my log, I have these problems:
Notice: Undefined offset: 0 in comment_notify_unsubscribe_by_hash() (line 268 of public_html/drupal/sites/all/modules/comment_notify/comment_notify.inc)
Notice: Trying to get property of non-object in comment_notify_unsubscribe_by_hash() (line 268 of public_html/drupal/sites/all/modules/comment_notify/comment_notify.inc).
These are the errors immediately after installing the latest version of comment notify.
Comment | File | Size | Author |
---|---|---|---|
#4 | comment_notify-unsubscribe_by_hash_error-2328055-4.patch | 1.08 KB | ivanstegic |
Comments
Comment #1
evelien CreditAttribution: evelien commentedproblem still exists. I think this isn't priority normal, but major. People can't unsubscribe and will therefore receive unwanted e-mails.
Comment #2
evelien CreditAttribution: evelien commentedfound something more, changing to normal again. Error occurs when the original comment is removed. It seems that while removing nodes and/ or comments, the DB for comment notification isn't updated and therefore you'll get an error. It isn't pretty, but isn't major either.
Comment #3
gregglesThanks for updating with the causes of this issue. Updating the title and removing some issue tags that don't seem relevant to me.
Comment #4
ivanstegic CreditAttribution: ivanstegic at TEN7 commentedI can confirm that I've seen this behavior on a live production site. In our experience, it isn't that the unsubscribe link didn't work, it was that it was already used once before, and the user had already been unsubscribed. This normally works just fine, but there is this edge case where a deleted anonymous comment makes a difference. The attached patch fixes this by (1) checking for an array element, which prevents the nasty error message, and (2) tweaking the unsubscribe messaging to go from
to
Comment #5
gregglesThose seems like improvements. Thanks!
I wonder if that can be improved further so that the message just says "You are already unsubscribed." in the cases where we believe that to be the case?
Comment #6
ivanstegic CreditAttribution: ivanstegic at TEN7 commented@greggles I don't think that's the case since the error message is generated in a place where, potentially, something else could have gone wrong so just including "You are already unsubscribed." may be misleading. I might be wrong about how I'm reading that function though, so I'm open to listen :)
Comment #7
lexfunk CreditAttribution: lexfunk at TEN7 commentedI reviewed the patch and it works for the problems described.
Thanks