Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I need to extend a Drupal6 based system. I'm not too familiar with it since I overtook administration from another group. It has a product registration system wich uses webforms and a custom module. The user have to be able to edit the their own submitted webform but only until the status is set to accepted.

I switched on permissions for users to edit their content, and it works fine, but I need to revoke this permission based on a field in the webform. When the field value is set to "new" or "pending" the user must be able to edit the content, but when the business owner sets that field to "accepted", the user shouldn't be able to edit that submission any more.

How can I catch user permissions and only let users edit certain content when I want?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Just place a hook_form_alter() or a hook_form_FORM_ID_alter() (just for your webform) in your module.

Then inside the code check that the webform status is valid before committing the update or redirect to to an error page.

share|improve this answer
    
Thanks, that's a good idea. But I ran into another problem. On hook_form_alter() I don't have the values of the webform yet, just the structure. What hook do I need to catch to access webform values after they have been populated, but before displaying? –  Moha Dec 22 '12 at 22:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.