In my Drupal 7 site I have content type Job.

Recruiters post information about open positions. Registered users can apply for any position by flagging node using the Flag module. I have built custom form for recruiters where they can manage applications. With this form recruiters can review profile and select candidate for position by submitting the form.

I want to hide/unpublish content when form is submitted and notify user via email that his application was confirmed. How can this be done programmatically?

Also I'm using Rules. If these actions can be implemented via Rules, how can I create event and conditions to perform actions against specific user id and node id?

2 Answers 2


If you want to keep it within your custom form, you can modify the hook_form_submit() to include a call to drupal_mail() to send the message, and then the content un-publishing really depends on what content you want to effect.

I haven't used it before, but you could also take a look at Rules Forms Support if you want to keep it in Rules:

Rules Forms Support provides a Rules based method for controlling forms and their elements. The module can be used to alter any form provided by Drupal core or contributed modules. Change element titles, descriptions, weights, and more, or validate form data and set form errors. Rules forms saves time and cost by affording site builders the ability to monitor and alter forms without the need to implement a custom module.


The Rules module is, for sure, your best bet for addrerssing this (therefor +1 for this question already ...).

Can you further enhance (edit) your question to explain what you have tried already using Rules? And what worked, or failed, and what the remaining questions are while using the Rules module? I.e.:

  • which events?
  • which conditions?
  • which actions?

For anybody not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework, organized in 7 chapters. Possibly also the similar set of 8 video tutorials about the Flag module, often considered as a natural complement to the Rules module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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