wordpressgravity-forms-plugingravityforms

How to get formatted text in gform_notification hook?


I try to save some details of a submitted Gravity Forms form in a post, but the problem is that when I use gform_notification hook $notification contains the message with merge tags, so it looks like this:

First name:

{First name:1}

Last name:

{Last name:2}

but I would need the actual values.

If anybody has an idea how to get the notification message that actually goes out please let me know.

Thank you in advance!


Solution

  • The GFCommon::replace_variables() static method replaces merge tags.

    Run $notification['message'] through the GFCommon::replace_variables() method.

    Source: https://community.gravityforms.com/t/accessing-render-merge-tag-data-in-notification-message-using-gform-notification-resolved/5609