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

  • $process_shortcodes boolean

    Is shortcode processing enabled? Default is false.

  • $form Form Object

    The current form object.

  • $feed Feed Object

    The 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 should be placed in the functions.php file of your active theme.

Since

This filter was added in Slack 1.3.1.

Source Code

gf_apply_filters( 'gform_slack_process_message_shortcodes', $form['id'], false, $form, $feed )

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