I have created a view using VBO so that a membership coordinator can record dues payment for the selected members. I use the "Modify profile fields" action. For this I select the two fields I want to change, enter the appropriate values, select the users I want to modify, and press the "Modify profile fields" button. This works great. However, it would be nice if it were possible to always select those two profile fields automatically, not show any of the other profile fields, and hide the checkboxes for selecting the fields. What I would like to see in the "style options" is the following when "Modify profile fields" is selected in "selected options":
- A checkbox to indicate whether you want the user to be able to choose which profile to modify.
- If not checked, it works the same as it does now.
- If checked, another display with a set of profile field checkboxes is displayed so that a user can select which profile fields to show in the VBO profile form. Also, the checkbox are not shown in the VBO profile form.
- A checkbox to specify whether the "Category" field is shown in the VBO profile form.
Something else that would also be nice would be to be able to override the name of the action button.
I have managed to work around all of this by adding jQuery code to the Views footer to select the two profile fields I want, delete all the other rows, hide the checkboxes column, and delete the category column. I also change the name of the "Modify profile fields" button to "Submit". I've enclosed a screenshot of this modification. I've also enclosed the jQuery code.
The downside of this is that when the page is first displayed you momentarily see the entire VBO profile form and my modification runs. I've warned my membership coordinator about this.
<?php include_once("scripts/membership.inc"); ?>
<script>
$(document).ready(function()
{
// Remove table rows that are not related to dues in profile action table
$("form#views-bulk-operations-form--1 table:lt(2) tr:not(:contains('Dues'))").remove();
// Remove table rows that are not related to MDA in profile action table
$("form#views-bulk-operations-form--1 table:lt(2) tr:not(:contains('MDA'))").remove();
// Hide the checkbox column in profile action table
$("form#views-bulk-operations-form--1 table:lt(2) th:eq(0)").hide();
$("form#views-bulk-operations-form--1 table:lt(2) td:nth-child(1)").hide();
// Remove category column in profile action table
$("form#views-bulk-operations-form--1 table:lt(2) th:eq(1)").remove();
$("form#views-bulk-operations-form--1 table:lt(2) td:nth-child(2)").remove();
// Change the name of the "Modify profile fields" button to "Submit"
$("input#edit-submit").attr("value", "Submit");
// Select checkboxes related to MDA in profile action table
$("form#views-bulk-operations-form--1 table:eq(1) tr:contains('MDA') :checkbox").each(
function()
{
this.checked = "checked";
this.onchange();
});
// Set MDA fiscal year in profile action table to dues payment fiscal year
$("#edit-profile-mda-dues-fiscal-year").attr("value", <?php print print membership_get_fiscal_year_dues_payment("MDA"); ?>);
});
</script>
Note: the reason why I use :lt(2) for the table alterations is that I have sticky table headers, and this creates a duplicate of the VBO profile table.
| Comment | File | Size | Author |
|---|---|---|---|
| MDADues.png | 17.21 KB | creeksideplayers |
Comments
Comment #1
creeksideplayers commentedOops! Ignore the extra print statement in the code above.
Comment #2
infojunkieRe: action label, this is implemented in the latest dev.
Otherwise, I guess you mean something like the options for "Modify node fields", where you choose which fields should appear to the user, in the VBO style settings?
Comment #3
creeksideplayers commentedThanks, infojunkie. That's exactly what I mean.
Comment #4
creeksideplayers commentedAny plans to add this functionality?
Comment #5
fionamccaskill commentedThis functionality would be useful for us also.
Comment #6
infojunkieSorry, but I'm no longer implementing feature requests for D6.