Using Gravity Forms ‘gform_campfire_message’ PHP filter

The gform_campfire_message Gravity Forms PHP filter allows you to dynamically modify the message before it is sent to Campfire.

Usage

To apply the filter to all feeds:

add_filter('gform_campfire_message', 'your_function_name', 10, 4);

To target feeds for a specific form, append the form ID to the hook name (e.g., gform_campfire_message_FORMID):

add_filter('gform_campfire_message_4', 'your_function_name', 10, 4);

Parameters

  • $message (string) – The message to be sent to Campfire.
  • $feed (Feed Object) – The feed currently being processed.
  • $entry (Entry Object) – The entry currently being processed.
  • $form (Form Object) – The form currently being processed.

More information

See Gravity Forms Docs: gform_campfire_message

Examples

Modify message for all feeds

This example changes the message for all feeds.

add_filter('gform_campfire_message', 'change_message', 10, 4);

function change_message($message, $feed, $entry, $form) {
    return 'your new message';
}

Modify message for a specific feed

This example changes the message for a specific feed named “Campfire Feed 2” in form ID 4.

add_filter('gform_campfire_message_4', 'change_another_message', 10, 4);

function change_another_message($message, $feed, $entry, $form) {
    if (rgars($feed, 'meta/feedName') == 'Campfire Feed 2') {
        $message = 'your new message';
    }
    return $message;
}

Place this code in the functions.php file of your active theme.

The filter is located in GFCampfire::process_feed() in class-gf-campfire.php.