Created
November 6, 2014 16:12
-
-
Save spivurno/bab7f701e5a3eead6fa3 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Get the percentage reached for the entry limit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Function | |
function gwiz_get_entry_limit_percentage( $form_id ) { | |
$form = GFAPI::get_form( $form_id ); | |
$entry_count = RGFormsModel::get_lead_count( $form['id'], '', null, null, null, null, 'active' ); | |
$entry_limit = rgar( $form, 'limitEntriesCount' ); | |
$percentage = ( $entry_count * 100 ) / $entry_limit; | |
return $percentage; | |
} | |
// # Usage | |
echo gwiz_get_entry_limit_percentage( 449 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment