Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
7.x-3.x-dev
Component:
Actions
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2012 at 19:39 UTC
Updated:
20 Dec 2013 at 15:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
David_Rothstein commentedHere's the patch.
Comment #2
imp7 commentedThanks David_Rothstein works great, I added some permission checks in my patch. I imagine there is a better way to throw errors in vbo?
Comment #3
imp7 commentedWhy doesn't d.org let me edit a typo in the attachment.
Comment #4
bojanz commented@imp7
I think an action is the wrong place to add your custom permission checks.
@David_Rothstein
The problem with the current code is that user_cancel() sets a status message per each processed user.
100 blocked users == 100 messages (+ 1 from VBO), which is quite bad usability wise.
Perhaps we want to implement our own user_cancel() that adds a final step to the batch that does drupal_get_messages('status', TRUE) to remove the set messages? (Doing it right after user_cancel() is invoked doesn't work, it needs to happen after the batch as far as I can see)
Comment #5
petednz commentedhi nice to see some work on this - i am guessing that this will be a necessary option for us if we want to use VBO to cancel accounts and in doing so report them to Mollom.
Comment #6
loze commentedThe patch in #1 works for me. Thanks.
Comment #7
David_Rothstein commentedThis is true, although the standard admin/people page in Drupal core also results in one message for each processed user, so at least it's not really a regression compared to that.
Comment #8
xurizaemonWithout the permissions checks in the action.
I kind of want to add the perm check to action info, but (1) it won't cover the "administerusersbyrole" module in previous patch, (2) it looks like other actions like user_role don't include a 'permissions' attribute for their actions so I'm going to follow that here. (So ... in VBO-land, sites typically implement permissions checks at the View layer? That wouldn't have been my expectation.)
EDIT: Ugh, this isn't right, will post a replacement shortly.
Comment #9
xurizaemonUpdated.
--author="drothstein <drothstein@124982.no-reply.drupal.org>"please as he's the original author.And ... I see the patch in #1 is basically identical, except = is replaced with += in #9 in views_bulk_operations_user_cancel_action_form
Comment #10
roam2345 commentedwrong patch.. plz ignore this one.
Comment #11
roam2345 commentedFix all out standing issues with patch.
Comment #12
roam2345 commentedFollow what bojanz said and implement our own user_cancel.
Comment #13
geerlingguy commentedThis patch works great, and allows me to cancel accounts in much the same way as Drupal 7's built-in 'People' page. Once the operation completes (if it's not enqueued), it displays a bunch of messages like "The update has been performed.", then "username has been deleted.".
Not a big deal, but when you cancel more than a few hundred users, this list is quite long!
Comment #14
bojanz commentedRewrote views_bulk_operations_user_cancel_action() to prevent the double batching that #12 had, and to prevent the message-per-user that all patches had. Also added the ability for admin to check whether notifications will be sent.
Also added code that prevents the user from cancelling himself.
http://drupalcode.org/project/views_bulk_operations.git/commitdiff/256f8...
The original code had a cache clear for each cancellation, I removed it for performance reasons, we might want to readd a cache clear at the end of the complete process.
Test and let me know if you find any issues.
Comment #15
geerlingguy commentedI was about to come back here and post the exact points you just mentioned... but I think that about takes care of it. We were batching 14,000 user cancellations with #12, and cancelled it after an hour or so. Patch #14 fixes this and makes the operation take a lot less time.