When there is no operation available (such as because of action permissions and the permissions table), the bulk operation selector drop down, "Execute" button and checkboxes should not appear. (Currently there is just one option "Choose an operation", so nothing can actually be executed.)
Assuming the view is a tabular view, the column can be removed when there are no operations by selecting the "Hide empty column" option in the Views table formatter settings.
In all cases, the "No results" configuration for the field should also take effect.
There is a patch for this same feature but for version 6.x-1.x at #1144506: Hide operations selector & checkboxes if no operation available, Drupal 6.
Comments
Comment #1
Bevan commentedThis patch is for
7.x-3.x-rc1, for anyone running rc1 instead of dev and wants to patch it now.Note there is another patch with this feature but for version
6.x-1.xat #1144506: Hide operations selector & checkboxes if no operation available, Drupal 6.Comment #2
johnpitcairn commentedIs it possible to hide the operations fieldset (and table column?), or perhaps apply a "no-operations" class to the fieldset (and table column?)
Comment #3
Bevan commentedThe column hides itself if you select the "Hide empty column" option in the Views table formatter settings, as per the description. IIRC the fieldset also hides itself. Do you want the column and fieldset to show even if there are no operations?
Comment #4
johnpitcairn commentedDuh. I'd missed the "empty column" checkbox, thanks ;-)
The select element hides but the enclosing fieldset does not hide itself. I'm currently using a simple form alter to do that:
Comment #5
Sinan Erdem commentedI applied the patch for RC1. It removed the Operations for every user, even for user 1.
Comment #6
elBradford commentedRegarding comment #4, I updated the patch so the "Operations" fieldset is hidden for users without available actions. This is on the most recent dev version (sorry #5) and REPLACES the patch in #1. Please review and commit.
Comment #7
elBradford commentedBump, please review.
Comment #8
johnpitcairn commentedPatch does not apply to current dev.
Comment #9
elBradford commentedSorry, we don't really need the patch on our site anymore, so I can't test it. Look at the patch I submitted and try to adapt it to the new dev, it shouldn't be difficult.
Comment #10
tammo commentedI tried the current dev (dec 2012), but the patch was not/partly in there. Is there a plan to commit this patch, so this really wished for feature would come into the "main stream" of this module?
Anyway: when a user has no rights to start any of the VBO, he still is shown the (empty) field set for operations.
And indicating "do not show if empty" in Views did not work either...
Comment #11
adamtong commentedthe patch is #6 is not work for current dev version and 7.x-3.1 version.
Comment #12
danepowell commentedHere is a version of #6 updated to work with 3.1. Additionally, #6 did not hide the 'select all' checkboxes - this version does.
Comment #13
bojanz commentedI committed a much simpler solution, building upon my previous
commit in #2002300: Not able to exclude VBO field using "exclude from display":
http://drupalcode.org/project/views_bulk_operations.git/commitdiff/ee5c8...
It doesn't require any changes to the view or any field configuration, the vbo form & field just disappear if no operations are available.
EDIT: And I also forgot to credit Bevan and elBradford. Sorry guys, wasn't intentional, it's just late.
Comment #14
elBradford commentedNo worries bojanz, just nice to see it's fixed. And props on a very elegant solution.
Comment #16
Bevan commentedditto elBradford.
Comment #17
acbramley commentedThis doesn't work in the latest stable release, the get_selected_operations() method is returning an array, not an integer, so adding a simple count() call around the method fixes the issue. Patch attached.
Comment #18
acbramley commentedComment #19
bojanz commentedHm, not sure how I missed that.
Thanks, committed!