Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/bab7f701e5a3eead6fa3 to your computer and use it in GitHub Desktop.
Save spivurno/bab7f701e5a3eead6fa3 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Get the percentage reached for the entry limit
// # 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