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.
There's a bit of discussion on the Writing actions handbook page. The code presented there is actually out of sync now with http://api.drupal.org/api/function/user_block_user_action.
The problem is that $user->name will only be set if we are working with the global $user. Otherwise the watchdog message will just be Blocked user .
This affects 7.x and 6.x.
Comment | File | Size | Author |
---|---|---|---|
#9 | user.module.patch | 620 bytes | entendu |
#8 | user.module.patch | 537 bytes | entendu |
#6 | user_497358_incomplete_watchdog_message.patch | 1.04 KB | matason |
#3 | user_block_user_action.patch | 1.04 KB | matason |
Comments
Comment #1
gpk CreditAttribution: gpk commentedRelated: #330090: Check_plain shouldn't be used in watchdog-call in user_block_user_action.
Comment #2
Avivatech CreditAttribution: Avivatech commentedi am new here....!
Comment #3
matason CreditAttribution: matason commentedI've attached a small patch which should fix this.
Comment #5
matason CreditAttribution: matason commentedI'm not sure why this is failing now, the patch still runs against a freshly checked out HEAD, will investigate some more.
Comment #6
matason CreditAttribution: matason commentedI've recreated the patch and tested it, seems to work okay.
Comment #8
entendu CreditAttribution: entendu commentedDrupal 6 backport attached
Comment #9
entendu CreditAttribution: entendu commentedOops, rerolled the D6 patch with #330090 in mind. Disregard last one.
Comment #10
ohnobinki CreditAttribution: ohnobinki commented#3: user_block_user_action.patch queued for re-testing.
Comment #12
ohnobinki CreditAttribution: ohnobinki commentedIt looks like this is fixed by the following change in drupal-7 for #721086: Create tests for system actions, clean up token replacement, clean up triggers: