Thanks. I made quick and dirty solution by combining couple of examples
function count_with_avecs($form){
$count = 0;
$leads = RGFormsModel::get_leads($form["id"]);
foreach($leads as $id => $lead) {
$count++;
if( $lead['8.1'] == "KYLLÄ" ) $count++;
}
if( $count >= $form['limitEntriesCount'] ) {
$limit_message = $form['limitEntriesMessage'];
add_filter('gform_get_form_filter', create_function('', "return '<p class=\"limitmessage\">$limit_message</p>';") );
}
return $form;
}
add_filter("gform_pre_render", "count_with_avecs");
TODO: fix if( $lead['8.1'] == "KYLLÄ" ) to search right field automaticly (This KYLLÄ means Yes and it's the value. It can be easily changed to field to have different count in it...)
Posted 11 years ago on Monday February 25, 2013 |
Permalink