Hello, I would like to ask if it's possible to control the limitation in the number of submissions not just in the configuration of the webform but according to other data in the drupal database related to the user filling it (for example, if someone has bought 3 of the same products that allow him/her to send 3 submissions) Thanks!

Comments

quicksketch’s picture

You could potentially do this with a hook_nodeapi(). Due to the infinite number of criteria that users could use to create limits, this won't be an option in the Webform UI.

mymodule_nodeapi(&$node, $op, $teaser, $page) {
  if ($node->type == 'webform') {
    $number_of_purchases = some_function_get_purchases();
    $node->webform['submission_limit'] = $number_of_purchases;
  }
}
daniorama’s picture

Thank you a lot quicksketch. I will try it and as soon as I find how to connect it with Ubercart (that's what I'm using) I will post it here. I think this could help a lot for event registration. I know there is a module doing integration with Webform and Ubercart but it's giving me some errors and I need this as soon as possible. I will try it.

If I create my own customized module what should I put in the submission limit when I create the webform? Should I put without limits or should I create a limit (I mean, what will control the limitation? the UI field, my module or both of them together?)

I would like to change the submission limit in just some of the webforms. Is it possible to clone the "webform" content type so I use it in the condition or it would be better to use another kind of condition?

Thanks again!

quicksketch’s picture

It's not possible to copy the webform content type as it is sort of a "classic" content type, from the days before CCK or even custom content types. So it's not possible to have multiple types that have webform's functionality. However, you could work around this problem by adding a Taxonomy or CCK select list to your type, then checking the taxonomy term in your hook_nodeapi(), and only applying the limit if the webform has a certain term.

daniorama’s picture

Yes, you are right, that is a far better option. Thanks again!

You have helped me a lot, I will try now on my own to create a custom module for this issue. As long as I have something working and if someone is also interested I will post it here, but I have to say this would be a "cheap" customized module for my needs just to get this working.

quicksketch’s picture

Status: Active » Closed (fixed)