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.

Files: 
CommentFileSizeAuthor
#9 user.module.patch620 bytesentendu
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user.module_101.patch. View
#8 user.module.patch537 bytesentendu
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user.module_100.patch. View
#6 user_497358_incomplete_watchdog_message.patch1.04 KBmatason
Failed: 14698 passes, 0 fails, 1 exception View
#3 user_block_user_action.patch1.04 KBmatason
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user_block_user_action.patch. View

Comments

gpk’s picture

Avivatech’s picture

i am new here....!

matason’s picture

Status: Active » Needs review
FileSize
1.04 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user_block_user_action.patch. View

I've attached a small patch which should fix this.

Status: Needs review » Needs work

The last submitted patch failed testing.

matason’s picture

I'm not sure why this is failing now, the patch still runs against a freshly checked out HEAD, will investigate some more.

matason’s picture

Status: Needs work » Needs review
FileSize
1.04 KB
Failed: 14698 passes, 0 fails, 1 exception View

I've recreated the patch and tested it, seems to work okay.

Status: Needs review » Needs work

The last submitted patch failed testing.

entendu’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs work » Needs review
FileSize
537 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user.module_100.patch. View

Drupal 6 backport attached

entendu’s picture

FileSize
620 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user.module_101.patch. View

Oops, rerolled the D6 patch with #330090 in mind. Disregard last one.

ohnobinki’s picture

#3: user_block_user_action.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, user.module.patch, failed testing.

ohnobinki’s picture

It 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:

--- modules/user/user.module
+++ modules/user/user.module
@@ -3401,3 +3403,4 @@
   drupal_session_destroy_uid($uid);
-  watchdog('action', 'Blocked user %name.', array('%name' => $user->name));
+  $account = user_load($uid);
+  watchdog('action', 'Blocked user %name.', array('%name' => $account->name));
 }

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.