• Resolved pracko

    (@pracko)


    Is it possible to get a shortcode to display/work as part of a form submission success message?

    I’m using the form as an opt-in to a gated content page. Access to the gated page is possible once the plugin’s (Before And After plugin) shortcode is displayed on the page. However, when I place my shortcode within a success message, it is rendered as plain text within the form wrapper, causing the shortcode to not work as intended.

    Any suggestions as to how I can get this to work? Maybe a functions.php action? Here’s what the plugin’s developer suggested, but I’m not sure on how to implement it: “If there is a hook / action that is fired on Mautic forms when the form is submitted, you could attach a function to that that runs do_shortcode(“[complete_goal NNN]”); when this particular form is submitted.”

    Thanks.

    • This topic was modified 7 years, 9 months ago by pracko.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shulard

    (@shulard)

    Hello @pracko,

    Is the shortcode added in Mautic form definition or inside WordPress code ?

    A shortcode must be interpreted with the do_shortcode function to be rendered properly on the page, if you add it inside you form success message without applying this function it’ll be displayed as plain text.

    Actually, there isn’t any action trigger by the mautic plugin when a form is submitted (this a nice feature idea, I’ll add it to our roadmap :)) so you must interpret the shortcode yourself.

    If you post some code using gist.github.com or a service like that, I can guide you more easily through your code.

    Stéphane

    Plugin Author shulard

    (@shulard)

    Hello !

    We just released a new plugin version, please take a look ??

    It’s not directly related to your question here. Since the solution has been given, I mark this thread as resolved. If you have further questions, please open an issue on Github or ask directly on the slack community !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display a shorcode in form success message?’ is closed to new replies.