PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Hooks, Shortcode to populate dynamically

  1. Hi!
    i have a shortcode [prezzocarta] who works perfectly in the site.
    I'm using woocommerce with gravity form plugin.
    When i set an hidden form "auto populate dynamically" using the [prezzocarta] shortcode... id does not do anything.. simply ignore it.

    The shortcode generate a value based on the product category.

    Posted 11 years ago on Monday January 21, 2013 | Permalink
  2. I have been trying to find a way to have Gravity Forms process shortcodes as part of their form. Like in the form title or the form button text or the thank you html. I know to add shortcode capability to other parts of WP (widgets and title tadg) I can add a filter to the funciton.php file that does do_shortcode but I am not sure what the filter would be on for gravity forms or even if there is something I could add a filter to. Any information would be helpful.

    Thanks
    Greg

    Posted 11 years ago on Monday January 28, 2013 | Permalink
  3. Many parts of the Gravity Form currently process shortcodes. Where specifically did you want to use shortcodes? There are no filters you can add to allow shortcodes to be processed in areas of the Gravity Form where they currently are not.

    Posted 11 years ago on Tuesday January 29, 2013 | Permalink
  4. I kind of found a work around myself, it was a multiple part thing. First I added `

    add_filter('gform_submit_button', 'do_shortcode');

    to functions.php to allow shortcodes in the submission button to work properly.

    Then to allow shortcode processing in the notification email I had to use:

    add_filter('gform_pre_submission_filter', 'change_notification');
    function change_notification($form){
    $form['notification']['subject'] = do_shortcode($form['notification']['subject']);
    }

    I probably could have just did

    $form['notification']= do_shortcode($form['notification']);

    to process all the shortcodes present in the notification but I only needed the subject shortcode processed.

    Hope this helps others.

    Posted 11 years ago on Tuesday January 29, 2013 | Permalink
  5. Thank you for posting your work around. That's pretty neat.

    Posted 11 years ago on Wednesday January 30, 2013 | Permalink