gform_slack_process_message_shortcodes

Description

This filter can be used to enable shortcode processing in the Slack message.

Usage

The following would apply to all forms:

add_filter( 'gform_slack_process_message_shortcodes', 'your_function_name', 10, 3 );

To target a specific form append the form id to the hook name. (Format: gform_slack_process_message_shortcodes_FORMID)

add_filter( 'gform_slack_process_message_shortcodes_4', 'your_function_name', 10, 3 );

Parameters

ParameterTypeDescription
$process_shortcodesbooleanIs shortcode processing enabled? Default is false.
$formForm ObjectThe current form object.
$feedFeed ObjectThe current feed object.

Examples

1. Enable for all forms

This example shows how you can enable shortcode processing for all forms.

add_filter( 'gform_slack_process_message_shortcodes', '__return_true' );

2. Enable for a specific feed name

add_filter( 'gform_slack_process_message_shortcodes', function( $process_shortcodes, $form, $feed ) {
	return rgars( $feed, 'meta/feed_name' ) == 'Slack Feed 1' ? true : $process_shortcodes;
}, 10, 3 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Slack 1.3.1.

Source Code

This filter is located in GFSlack::process_feed() in class-gf-slack.php.