(Drupal 7) My situation is the following: I am using one single webform on my Drupal page that shows up on the page in different places for different events and gets a unique ID for each event to group results by. So when someone submits it to register for event A, the result will have ‘A’ as its event ID in the submission table; when someone registers for event B (on a different part of the page), the result gets saved with ‘B’ as its event ID etc.
I now would like to limit submissions per event, i.e. check the already submitted results for the webform to see how many submissions have been made with a certain ID already, so that I can the decide to either display the webform or a ‘limit reached’ message.
I’d be happy to either:
- check the submissions in PHP code in my template file where I display the webform and learn how to filter submission results so I can get the count for a certain event ID
or
- get the submission results and filter them by ID for counting in a Drupal View so I can then make the view display the webform block or the message
Either is fine with me but so far I am stuck with both of these ideas. I do not know and couldn’t find out online so far how to access a given webform’s already submitted results in a PHP template file. And for the Views approach, I’ve installed Webform MySQL Views module hoping to get more options there but I couldn’t figure out how to get access to the indidual fields of the webform submissions; the ones that show up in the normal Webform submission tables.
In short, I am looking for a way to get the count for a webform’s submissions filtered by a field of those submissions. ‘Tell me how often this form has been submitted already with X as the value in the Y field.’
Any help would be greatly appreciated. Thank you.