Using Gravity Forms ‘{$SHORT_SLUG}_feed_actions’ PHP action

The {$SHORT_SLUG}_feed_actions is a filter in Gravity Forms that allows you to add action links to feed items. The SHORT_SLUG is replaced with the add-on short slug.

Usage

To use this filter, replace {$SHORT_SLUG} with the short slug of the add-on you want to use.

add_filter( '{$SHORT_SLUG}_feed_actions', 'your_function_name' );

For example, for the ‘mailchimp’ add-on you would use mailchimp_feed_actions

add_filter( 'mailchimp_feed_actions', 'your_function_name' );

Parameters

  • _action_links array: This is the existing action links on the feed item.
  • item array: This is the feed item.
  • column array: This is the column ID.

More Information

See Gravity Forms Docs: {$SHORT_SLUG}_feed_actions

This filter was implemented in Gravity Forms Plugin and is located in class-gf-feed-addon.php. For the list of available short slugs, see the article Gravity Forms Add-On Slugs.

Examples

Adding a Custom Action to MailChimp Feed

This example adds a custom action link to MailChimp feed items.

add_filter( 'mailchimp_feed_actions', 'add_custom_mailchimp_action' );

function add_custom_mailchimp_action( $action_links, $item, $column ) {
  // add a custom action
  $action_links['custom_action'] = array(
    'label'        => __( 'Custom Action', 'textdomain' ),
    'url'          => '#',
    'capabilities' => 'gravityforms_mailchimp',
    'onclick'      => 'alert("You clicked custom action!")'
  );
  return $action_links;
}

Removing an Action from MailChimp Feed

This example removes a specific action link from MailChimp feed items.

add_filter( 'mailchimp_feed_actions', 'remove_mailchimp_action' );

function remove_mailchimp_action( $action_links, $item, $column ) {
  // remove a specific action
  unset($action_links['specific_action']);
  return $action_links;
}

Adding a Custom Action to Stripe Feed

This example adds a custom action link to Stripe feed items.

add_filter( 'stripe_feed_actions', 'add_custom_stripe_action' );

function add_custom_stripe_action( $action_links, $item, $column ) {
  // add a custom action
  $action_links['custom_action'] = array(
    'label'        => __( 'Custom Action', 'textdomain' ),
    'url'          => '#',
    'capabilities' => 'gravityforms_stripe',
    'onclick'      => 'alert("You clicked custom action!")'
  );
  return $action_links;
}

Adding Multiple Custom Actions

This example shows how to add multiple custom action links to MailChimp feed items.

add_filter( 'mailchimp_feed_actions', 'add_multiple_custom_actions' );

function add_multiple_custom_actions( $action_links, $item, $column ) {
  // add multiple custom actions
  $action_links['custom_action1'] = array(
    'label'        => __( 'Custom Action 1', 'textdomain' ),
    'url'          => '#',
    'capabilities' => 'gravityforms_mailchimp',
    'onclick'      => 'alert("You clicked custom action 1!")'
  );

  $action_links['custom_action2'] =