Display Poll Results When Limit Is Reached
Instructions
Code
Filename: gpls-show-poll-results.php
<?php
/**
* Gravity Perks // GP Limit Submissions // Display Poll Results When Limit Is Reached
* https://gravitywiz.com/documentaiton/gravity-forms-limit-submissions/
*
* Instruction Video: https://www.loom.com/share/df98fa2dda97424495eb1757a772f6d0
*
*/
add_action( 'gform_get_form_filter', function( $markup, $form ) {
if ( ! is_callable( 'gf_polls' ) || ! gf_polls()->get_form_setting( $form, 'displayResults' ) ) {
return $markup;
}
if ( is_callable( 'gp_limit_submissions' ) && property_exists( gp_limit_submissions(), 'enforce' ) && gp_limit_submissions()->enforce->is_limit_reached() ) {
add_filter( "gform_get_form_filter_{$form['id']}", function( $markup, $form ) {
$results = gf_polls()->gpoll_get_results( $form['id'] );
$markup .= $results['summary'];
return $markup;
}, 11, 2 );
}
return $markup;
}, 10, 2 );