gform_campfire_message

Description

This filter is used to dynamically alter the message before it is sent to Campfire.

Usage

The following would apply 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. (format: 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.

Examples

1. All feeds

This example shows how you can change the message.

add_filter( 'gform_campfire_message', 'change_message', 10, 4 );
function change_message( $message, $feed, $entry, $form ) {

return 'your new message';
}

2. Specific feed

This example shows how you can change the message for a specific feed.

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;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

gf_apply_filters( 'gform_campfire_message', $form['id'], rgars( $feed, 'meta/message' ), $feed, $entry, $form )

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