Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active February 24, 2016 00:34
Show Gist options
  • Save zackkatz/82785402c996b51b4dc9 to your computer and use it in GitHub Desktop.
Save zackkatz/82785402c996b51b4dc9 to your computer and use it in GitHub Desktop.
Add an <optgroup> to Gravity Forms "Bulk action" dropdown using GravityView.
<?php
/**
* Requires GravityView 1.16.3 or newer
*/
add_filter( 'gravityview/approve_entries/bulk_actions', 'gv_approve_entries_bulk_actions_pizzafy', 10, 2 );
/**
* Add an <optgroup> to Gravity Forms "Bulk action" dropdown using GravityView.
*
* @param array $bulk_actions Associative array of actions to be added to "Bulk action" dropdown inside GravityView `<optgroup>`. Parent array key is the `<optgroup>` label, then each child array must have `label` (displayed text) and `value` (input value) keys. Values get sanitized by GV.
* @param int $form_id ID of the form currently being displayed
*
* @return array Bulk actions, with map
*/
function gv_approve_entries_bulk_actions_pizzafy( $bulk_actions = array(), $form_id = 0 ) {
$bulk_actions['GF Pizza-Pie'] = array(
array(
'label' => __( 'Send Free Pizzas', 'gravityview' ),
'value' => sprintf( 'pizzafy-%d', $form_id ),
),
);
return $bulk_actions;
}
@zackkatz
Copy link
Author

b8b2a60f-cbda-4ed4-8a6b-eec3fc4d7561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment