• Resolved Wil

    (@limecanvas)


    Noticed a little issue with this plugin.

    I recently had to remove the gravity forms shortcode form a page and build a template which dynamically called the PHP gravity_form() function, inserting dynamic data using the function.

    The plugin seems to check the post_content for the GF shortcode in function check_for_shortcode( $posts ), however, the GF PHP function doesn’t add the shortcode the the post_content, so the plugin never fires as the preg_match_all returns nothing.

    To recap, I have an empty page content in the WP editor but my page template calls the GF PHP function directly. e.g.

    <div class="entry-content">
    			<?php the_content(); ?>
                <?php
                // Output the Gravity Form
                echo gravity_form( 5, $display_title = false, $display_description = false );
                ?>
                <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->

    You may have to hook into one of the GF hooks. I believe the JavaScript gform_post_render() function would work nicely.

    https://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/javascript/gform_post_render/

    Perhaps you can enqueue it after the page loads on the “wp” action hook and check there?

    Cheerz,
    Wil.

    https://www.ads-software.com/plugins/gravity-forms-force-ssl/

Viewing 1 replies (of 1 total)
  • Plugin Author Timothy Wood

    (@codearachnid)

    That was an item on my todo list – the problem is that a clean redirect occurs prior to output and if someone hard codes this into their theme then the only clean way for a redirect is via JavaScript which is not a reliable mechanism for a secure form. It should be to the theme/plugin developer hard coding the form into their code to provide security option. If you wish to help me revise this stance i’d be more than happy to reopen the feature request.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin doesn't work with PHP called gravity_form() function’ is closed to new replies.