Two odd issues with my profile:

1) My contact form got mysteriously enabled. This is the second time this is happened. As most know, I've had my contact form disabled for years because I can't handle the flood in my personal inbox. When I edited my account, the box was checked. I unchecked it and it appeared to save, so this might be a hard one to understand what happened. There's a very very small chance that it is user error and that I somehow re-enabled it when I edited my profile a few days ago, but I am fairly sure I did not check that box when I did.

2) I an unable to uncheck the "Drupalcon news" checkbox. I uncheck it, hit save, and it's checked again. If it's a newsletter that can't be unsubscribed from, it shouldn't appear in the list.

Comments

drumm’s picture

Assigned: Unassigned » drumm

You certainly should be able to unsubscribe from all mailing lists. I'll see if I can figure anything out.

drumm’s picture

I deleted your subscription manually from MailChimp's admin. I can unsubscribe myself via my Drupal.org profile. And you were still listed as subscribed despite unsubscribing via a link in email a few weeks ago. Unless others have this issue, I'm thinking this could be some quirk in MailChimp.

drumm’s picture

If I run user_save(user_load(26979)), that checks Personal contact form. We occasionally do that to pro-actively bakery sync. This seems like a potential Drupal core issue.

drumm’s picture

Title: Odd issues with my profile » User's contact setting reverts to default when saving
Project: Drupal.org infrastructure » Drupal core
Version: » 7.x-dev
Component: Other » contact.module
Priority: Normal » Major

Yep, this looks like it is too aggressively reverts to the default:

function contact_user_presave(&$edit, $account, $category) {
  $edit['data']['contact'] = isset($edit['contact']) ? $edit['contact'] : variable_get('contact_default_status', 1);
}

Setting to major since this isa data loss bug that allows unwanted email to be sent.

drumm’s picture

Status: Active » Needs review
StatusFileSize
new785 bytes

Here is a quick patch. Still needs testing for new user creation. And probably needs tests.

drumm’s picture

Issue tags: +affects drupal.org

My reading of the D8 code makes this look fixed in D8.

drumm’s picture

StatusFileSize
new1.48 KB
new2.25 KB

Here are some tests.

The last submitted patch, 7: 2451449-test-only.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 7: 2451449.diff, failed testing.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB

The test-only patch failed where expected. Let's try this for the full patch.

Status: Needs review » Needs work

The last submitted patch, 10: 2451449.diff, failed testing.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new2.13 KB

Rewrote this to use the old category system.

Status: Needs review » Needs work

The last submitted patch, 12: 2451449.diff, failed testing.

drumm’s picture

StatusFileSize
new1.54 KB
new2.19 KB

Of course, $this->contact_user in the test will be a stale object. Adding in

$this->contact_user = user_load($this->contact_user, TRUE);

so that it can be cleanly be saved.

I'm sticking with checking $category in the module, that's the most authentic Drupal 7 way.

drumm’s picture

Status: Needs work » Needs review
drumm’s picture

StatusFileSize
new1.55 KB
new2.2 KB

… that should be

$this->contact_user = user_load($this->contact_user->uid, TRUE);

The last submitted patch, 14: 2451449.patch, failed testing.

The last submitted patch, 14: 2451449-test-only.patch, failed testing.

The last submitted patch, 16: 2451449-test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 16: 2451449.patch, failed testing.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new1.56 KB
new2.21 KB

Another try without overwriting $this->contact_user.

The last submitted patch, 21: 2451449-tests-only.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 21: 2451449.diff, failed testing.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new2.33 KB

Going back to my original patch from #5, with the working tests in #21.

drumm’s picture

My approach in #12 had failed because the default value for $category is 'account'. I think this approach is solid.

stefan.r’s picture

Issue tags: +Drupal 7.60 target
pol’s picture

Status: Needs review » Reviewed & tested by the community

Looking good to me.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Drupal 7.60 target

Committed to 7.x - thanks!

I think this was tagged for Drupal 7.60 under the assumption that that would be the next (non-security) release. Since it isn't, I'm just going ahead and committing it now for Drupal 7.55. It looks like a nice, self-contained fix.

  • David_Rothstein committed ef9608d on 7.x
    Issue #2451449 by drumm: User's contact setting reverts to default when...

Status: Fixed » Closed (fixed)

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