This means user actions and hook_user_presave() and hook_user_update() won't get invoked.

      db_update('users')
        ->fields(array('status' => 0))
        ->condition('uid', $account->uid)
        ->execute();
CommentFileSizeAuthor
#13 729796.patch1.93 KBbojanz
#9 729796-9.patch1.77 KBmarcingy
#3 729796-2.patch1.9 KBcatch

Comments

catch’s picture

It also bypasses invoking hook_user_logout(). In fact no hooks are invoked after a user is actually blocked or deleted via _user_cancel(), only hook_user_cancel(), which happens before.

catch’s picture

Status: Active » Needs review
StatusFileSize
new1.9 KB

Patch. Also brought user_block_action() into line.

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

Have tested locally and it works as advertised.

klausi’s picture

#3: 729796-2.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 729796-2.patch, failed testing.

marcingy’s picture

Priority: Normal » Major

Changing to major as per tag.

mustanggb’s picture

Tag update

marcingy’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB

Just a reroll to head.

kscheirer’s picture

How to test this patch?

moshe weitzman’s picture

Status: Needs review » Needs work

user_save() returns an $account object so no need to load it right afterwards

andypost’s picture

subscribe

bojanz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.93 KB

Reroll, addressed Moshe's criticism.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. This is pretty important to fix.

sun’s picture

Status: Reviewed & tested by the community » Needs review
+++ modules/user/user.module	23 Aug 2010 10:17:54 -0000
@@ -3461,12 +3456,8 @@ function user_block_user_action(&$entity
+  $account = user_save($account, array('status' => 0));

This can lead to infinite recursion when blocking a user upon user account update, no?

Powered by Dreditor.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Only if the account update tried to block already blocked users, no?

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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