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.

Show a new form when one form is closed

  1. I am trying to use the gform_pre_render hook to alter the limitEntriesMessage to show some custom text along with another form.

    Currently I am using this:

    add_filter('gform_pre_render', 'bbc_closed_text');
    function bbc_closed_text($form) {
    		// subtract the entry count from the limit to determine how many are left
    		$form['limitEntriesMessage'] = '<div class="closed gform_heading active"><img class="eighty-sixed" src="'.get_bloginfo('stylesheet_directory').'/images/eighty-sixed.png" />'.$form["description"].' <span class="remainder">* 0 Seats left</span><p>Aw, Shucks. Looks like you missed out this time. Check back soon so you can be a part of the next TBC meet up!</p></div><div class="subscribe-form"></div>';
    
    		// return the form
    		return $form;
    }

    What I would like to do is also show a sign up form for newsletters within that custom content in the "subscribe-form" div. I have tried this but no luck it just seems to break the site:

    add_filter('gform_pre_render', 'bbc_closed_text');
    function bbc_closed_text($form) {
    		// subtract the entry count from the limit to determine how many are left
    		$form['limitEntriesMessage'] = '<div class="closed gform_heading active"><img class="eighty-sixed" src="'.get_bloginfo('stylesheet_directory').'/images/eighty-sixed.png" />'.$form["description"].' <span class="remainder">* 0 Seats left</span><p>Aw, Shucks. Looks like you missed out this time. Check back soon so you can be a part of the next TBC meet up!</p></div><div class="subscribe-form">'.gravity_form(1, false, false, false, '', true).'</div>';
    
    		// return the form
    		return $form;
    }
    Posted 12 years ago on Monday April 30, 2012 | Permalink
  2. Resolved -

    Realized it was already passing the_content filters so this works out perfect:

    add_filter('gform_pre_render', 'bbc_closed_text');
    function bbc_closed_text($form) {
    		// subtract the entry count from the limit to determine how many are left
    		$newsletter = '[gravityform id="2" name="Newsletter" title="false" description="false" ajax="true"]';
    		$form['limitEntriesMessage'] = '<div class="closed gform_heading active"><img class="eighty-sixed" src="'.get_bloginfo('stylesheet_directory').'/images/eighty-sixed.png" />'.$form["description"].' <span class="remainder">* 0 Seats left</span><p>Aw, Shucks. Looks like you missed out this time. Check back soon so you can be a part of the next TBC meet up!</p></div><div class="subscribe-form">'.$newsletter.'</div>';
    
    		// return the form
    		return $form;
    }
    Posted 12 years ago on Monday April 30, 2012 | Permalink
  3. Right on, glad you got it working, thanks for letting us know.

    Posted 12 years ago on Monday April 30, 2012 | Permalink

This topic has been resolved and has been closed to new replies.