Groźne formularze FormSlimit zalogowani użytkownicy do dwóch wpisów dziennie
add_action('frm_display_form_action', 'check_entry_count', 8, 3);
function check_entry_count($params, $fields, $form){
remove_filter('frm_continue_to_new', '__return_false', 50);
global $user_ID;
if($form->id == 5 and !is_admin()){ //replace 5 with your form ID
$count = FrmEntry::getRecordCount("form_id=". $form->id ." AND it.created_at > '". gmdate('Y-m-d')." 00:00:00' AND user_id=".$user_ID);
//$count = FrmEntry::getRecordCount("form_id=". $form->id ." AND it.created_at > '". gmdate('Y-m')."-01 00:00:00' AND user_id=".$user_ID); // uncommented this line to limit by month instead of day
if($count >= 2){ //change 2 to your limit
echo 'This form is closed';
add_filter('frm_continue_to_new', '__return_false', 50);
}
}
}
uzii