nf_check_sub_limit

Function that checks the current sub count and updates the loading class if neccesary.

Description

nf_check_sub_limit( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'nf_check_sub_limit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/display/form/sub-limit.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = nf_check_sub_limit($form_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/display/form/sub-limit.php  
  1. function nf_check_sub_limit( $form_id ) { 
  2. global $ninja_forms_loading; 
  3.  
  4. if ( ! isset( $ninja_forms_loading ) ) 
  5. return false; 
  6.  
  7. $sub_limit = $ninja_forms_loading->get_form_setting( 'sub_limit_number' ); 
  8.  
  9. if ( !$sub_limit or empty ( $sub_limit ) ) 
  10. return false; 
  11.  
  12. $args = array( 
  13. 'form_id' => $form_id,  
  14. 'action' => 'submit',  
  15. ); 
  16. $sub_count = ninja_forms_get_sub_count( $args ); 
  17.  
  18. if ( $sub_count >= $sub_limit ) { 
  19. $ninja_forms_loading->update_form_setting( 'sub_limit_reached', true ); 
  20.