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.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Title: "Delayed roles for blocked user have been cleared" » Delayed roles cleared inappropriately on user update
Version: 6.x-1.0 » 6.x-1.x-dev
Priority: Normal » Critical
Status: Active » Needs review
FileSize
1.07 KB

This 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.

WorldFallz’s picture

Status: Needs review » Reviewed & tested by the community

nice catch-- thanks for the patch randy. I should be able to get it in today or tomorrow.

WorldFallz’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

committed to dev: http://drupalcode.org/project/role_delay.git/commit/ec67b80.

I need to do it for d7 also.

Leeteq’s picture

Issue summary: View changes

Is this going into 7.x-dev anytime soon?

WorldFallz’s picture

There'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.

  • Commit 4dfb053 on 7.x-1.x by WorldFallz:
    Issue #1804596 by rfay: Delayed roles cleared inappropriately on user...
WorldFallz’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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