The code below uses the php switch statement (a case structure) to evaluate certain forms to determine if they hit their limit. The echo command lets me output alternate actions if the limit is reached. If the form limit has been reached, the page displays options for the user to select. In the example, I've noted a wait list page which would display another form.
'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);
$count = FrmEntry::getRecordCount($form->id); // Gets the record count for the current form
switch ($form->id) {
case 25: // Evaluates for Form 25
if ( $count > 25 ) { //sets a limit for 25 submissions. You could also use >=26
echo '
The Formidable Forms Class you selected is full.
;
We hope to offer this class again in the future, so please keep
an eye on our Facebook page or our website
';
add_filter('frm_continue_to_new', '__return_false', 50);
}
break;
case 26:
if ( $count > 10 ) { //sets a limit for 10 submissions. You could also use >=11
echo '
The Rice Cooking Class you selected is full.
;
We hope to offer this class again in the future, so please keep
an eye on our Facebook page or our website
';
add_filter('frm_continue_to_new', '__return_false', 50);
}
break;
}
}
'