/** * Process our date submitted trigger. * When this function is called, it will be passed the value of the parameter and will expect a bool return. * * @since 1.2.8 * @return bool */ function compare($value, $compare) { global $ninja_forms_processing; $form_id = $ninja_forms_processing->get_form_ID(); $sub_count = nf_get_sub_count($form_id); return ninja_forms_conditional_compare($sub_count, $value, $compare); }
public function loading() { $form_id = isset($this->args['form_id']) ? absint($this->args['form_id']) : 0; if (empty($form_id)) { return array('complete' => true); } $sub_count = nf_get_sub_count($form_id); if (empty($this->total_steps) || $this->total_steps <= 1) { $this->total_steps = round($sub_count / 250, 0) + 2; } $args = array('total_steps' => $this->total_steps); return $args; }
public function loading() { $form_id = isset($this->args['form_id']) ? absint($this->args['form_id']) : 0; if (empty($form_id)) { return array('complete' => true); } $sub_count = nf_get_sub_count($form_id); if (empty($this->total_steps) || $this->total_steps <= 1) { $this->total_steps = round($sub_count / 250, 0) + 2; } $args = array('total_steps' => $this->total_steps); $this->args['filename'] = $this->random_filename('all-subs'); update_user_option(get_current_user_id(), 'nf_download_all_subs_filename', $this->args['filename']); $this->redirect = add_query_arg(array('download_all' => $this->args['filename']), $this->args['redirect']); return $args; }
/** * Filter our post counts for the submission listing page * * @access public * @since 2.7 * @return int $count */ public function count_posts($count, $post_type, $perm) { // Bail if we aren't working with our custom post type. if ($post_type != 'nf_sub') { return $count; } if (isset($_GET['form_id'])) { $sub_count = nf_get_sub_count($_GET['form_id']); $trashed_sub_count = nf_get_sub_count($_GET['form_id'], 'trash'); $count->publish = $sub_count; $count->trash = $trashed_sub_count; } else { $count->publish = 0; $count->trash = 0; } return $count; }
/** * Shortcode for ninja_forms_display_sub_number_remaining * * @since 2.8 * @return int * @see nf_get_sub_count() */ function ninja_forms_display_sub_number_remaining_shortcode($atts) { $form = Ninja_Forms()->form($atts['id']); if (isset($form->settings['sub_limit_number'])) { $sub_count = nf_get_sub_count($atts['id']); $sub_limit = (int) $form->settings['sub_limit_number']; if ($sub_count > $sub_limit) { return 0; } return $sub_limit - $sub_count; } else { return null; } }