27 'approve' =>
'gvapprove',
28 'disapprove' =>
'gvdisapprove',
29 'unapprove' =>
'gvunapprove',
37 if ( did_action(
'admin_init' ) ) {
41 add_action(
'admin_init', array( $this,
'process_bulk_action' ) );
55 $gv_bulk_action =
false;
57 if( version_compare( GFForms::$version,
'2.0',
'>=' ) ) {
65 if( ! empty( $bulk_action ) && preg_match(
'/^('. implode(
'|', self::$bulk_action_prefixes ) .
')/ism', $bulk_action ) ) {
66 $gv_bulk_action = $bulk_action;
69 return $gv_bulk_action;
80 if ( ! is_admin() || ! class_exists(
'GFForms' ) || empty( $_POST ) ) {
89 if ( ! ( $bulk_action && \
GV\Utils::_POST(
'gforms_entry_list' ) && empty( $_POST[
'gforms_update_note'] ) ) ) {
93 check_admin_referer(
'gforms_entry_list',
'gforms_entry_list' );
101 list( $approved_status,
$form_id ) = explode(
'-', $bulk_action );
104 gravityview()->log->error(
'Form ID is empty from parsing bulk action.', array(
'data' => $bulk_action ) );
109 if ( ! empty( $_POST[
'all_entries'] ) ) {
113 'search_field' => isset( $_POST[
'f'] ) ? $_POST[
'f'][0] : 0,
114 'search_value' => isset( $_POST[
'v'][0] ) ? $_POST[
'v'][0] :
'',
115 'search_operator' => isset( $_POST[
'o'][0] ) ? $_POST[
'o'][0] :
'contains',
126 $entries = isset( $_POST[
'lead'] ) ? $_POST[
'lead'] : $_POST[
'entry'];
135 $entry_count = count(
$entries ) > 1 ? sprintf( __(
'%d entries',
'gk-gravityview' ), count(
$entries ) ) : __(
'1 entry',
'gk-gravityview' );
137 switch ( $approved_status ) {
138 case self::$bulk_action_prefixes[
'approve']:
140 self::$bulk_update_message = sprintf( __(
'%s approved.',
'gk-gravityview' ), $entry_count );
142 case self::$bulk_action_prefixes[
'unapprove']:
144 self::$bulk_update_message = sprintf( __(
'%s unapproved.',
'gk-gravityview' ), $entry_count );
146 case self::$bulk_action_prefixes[
'disapprove']:
148 self::$bulk_update_message = sprintf( __(
'%s disapproved.',
'gk-gravityview' ), $entry_count );
165 $bulk_actions = array(
166 'GravityView' => array(
169 'value' => sprintf(
'%s-%d', self::$bulk_action_prefixes[
'approve'],
$form_id ),
173 'value' => sprintf(
'%s-%d', self::$bulk_action_prefixes[
'disapprove'],
$form_id ),
177 'value' => sprintf(
'%s-%d', self::$bulk_action_prefixes[
'unapprove'],
$form_id ),
189 $bulk_actions = apply_filters(
'gravityview/approve_entries/bulk_actions', $bulk_actions,
$form_id );
192 foreach ( $bulk_actions as $key => $group ) {
194 if( empty( $group ) ) {
198 foreach ( $group as
$i => $action ) {
199 $bulk_actions[ $key ][
$i ][
'label'] = esc_html( $bulk_actions[ $key ][
$i ][
'label'] );
200 $bulk_actions[ $key ][
$i ][
'value'] = esc_attr( $bulk_actions[ $key ][ $i ][
'value'] );
204 return $bulk_actions;
static get_bulk_actions( $form_id)
Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" op...
process_bulk_action()
Capture bulk actions - gf_entries table.
static update_bulk( $entries=array(), $approved=0, $form_id=0)
Process a bulk of entries to update the approve field/property.
get_gv_bulk_action()
Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action.
static get_search_criteria( $args, $form_id)
Parse search criteria for a entries search.
Handles interactions between GravityView and Gravity Forms' Bulk Actions menu on the Entries screen...
static $bulk_action_prefixes
static get_string( $value_or_key, $string_key='')
Get the label for a specific approval value.
if(empty( $created_by)) $form_id
gravityview()
The main GravityView wrapper function.
static $bulk_update_message
gravityview_get_entry_ids( $form_id, $search_criteria=array())
Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method.
__construct()
GravityView_Admin_Bulk_Actions constructor.
static _POST( $name, $default=null)
Grab a value from the _POST superglobal or default.