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.
I got a pile of these unusual messages after creating a new role with a delay, but since the users weren't blocked, I was baffled by the meaning.
Delayed roles for blocked user rfay have been cleared.
Comment | File | Size | Author |
---|---|---|---|
#1 | role_delay.delayed_roles_inappropriately_cleared.patch | 1.07 KB | rfay |
Comments
Comment #1
rfayThis ends up being a critical mission-defying bug. In many, many cases a simple user update (such as an admin making a change to the user) will result in delayed roles being cleared.
What's going on here is that in hook_user() 'update', the decision to clear delayed roles for the user is intended to be when the user is blocked. But the comparison is
if ($edit['status'] == 0)
. Well, if $edit['status'] is not set, which is very common (in my case when a user is updated by validating their account using logintoboggan's technique), this still evaluates to true.The attached patch changes to make sure that the user is actually being blocked, and makes sure that the comparison is type-safe ($edit['status'] === 0). It also removes a couple of drupal_set_message() calls that get shown to the actual user, when they really shouldn't be.
Comment #2
WorldFallz CreditAttribution: WorldFallz commentednice catch-- thanks for the patch randy. I should be able to get it in today or tomorrow.
Comment #3
WorldFallz CreditAttribution: WorldFallz commentedcommitted to dev: http://drupalcode.org/project/role_delay.git/commit/ec67b80.
I need to do it for d7 also.
Comment #4
Leeteq CreditAttribution: Leeteq commentedIs this going into 7.x-dev anytime soon?
Comment #5
WorldFallz CreditAttribution: WorldFallz commentedThere's no updated patch and I don't actually use it on d7 so it fell off my radar, but ill try to get to it this week.
Comment #7
WorldFallz CreditAttribution: WorldFallz commented