如何在gform_notification hook中获取格式化文本?

huangapple go评论53阅读模式
英文:

How to get formatted text in gform_notification hook?

问题

我尝试保存已提交的Gravity Forms表单的一些详细信息到帖子中,但问题是当我使用gform_notification挂钩时,$notification包含带有合并标签的消息,所以看起来像这样:

名字:

{名字:1}

姓氏:

{姓氏:2}

但我需要实际的值。

如果有人知道如何获取实际发送出去的通知消息,请告诉我。

提前谢谢!

英文:

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!

答案1

得分: 1

GFCommon::replace_variables() 静态方法替换合并标签。

> 通过 GFCommon::replace_variables() 方法运行 $notification['message']

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

英文:

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

huangapple
  • 本文由 发表于 2023年6月9日 02:46:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76434872.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定