Forked from spivurno/gw-gravity-forms-get-entry-limit-percentage.php
Created
September 5, 2016 04:31
-
-
Save phillipwilhelm/ad04937a74bb7aae665ae6c268281290 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Get the percentage reached for the entry limit
This file contains hidden or 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