Hide Form after X Amount of Entries

By: Nex-Tech Creative | Asked: 08/22/2024
ForumsCategory: General questionsHide Form after X Amount of Entries
Nex-Tech Creative asked 3 months ago
I am using Formidable and I want the form to not be available/hide after X amount of entries. I am using the Web Hook that formidable has provided and its not working. I have added the PHP snippet to the site using the WPCode plugin and it is active.   Here is the code I am using, which I have edited it some to make my conditions: add_action('frm_display_form_action', 'limit_entry_count', 8, 3); function limit_entry_count($params, $fields, $form){ remove_filter('frm_continue_to_new', '__return_false', 50); if ( in_array($form->id, array(5)) ) { //change 5, 6, and 7 to your form ID(s) $count = FrmEntry::getRecordCount($form->id); if ( $count >= 3 ) { //change 15 to your entry limit echo 'This form is closed'; add_filter('frm_continue_to_new', '__return_false', 50); }   } }   My form id is 5 My limit is set to 3 (for testing only)

The form test page is found here:   https://labels.nextechdemo.com/formtest/

I attached a screenshot of the settings in WPCode for the PHP Snippet   Can someone help me please with reviewing the code to see why it is not working? If additional informaton is needed, please let me know. THANK YOU
Attachments
1 Answers
Rob LeVineRob LeVine answered 3 months ago
I suggest setting up WP debugging and outputting the values in the function to the debug log. The values may not be what you think they are.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right