Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.30 diff -u -p -r1.30 contact.pages.inc --- modules/contact/contact.pages.inc 9 Oct 2009 15:39:12 -0000 1.30 +++ modules/contact/contact.pages.inc 10 Oct 2009 21:04:11 -0000 @@ -154,6 +154,11 @@ function contact_site_form_submit($form, flood_register_event('contact'); watchdog('mail', '%name-from sent an e-mail regarding %category.', array('%name-from' => $values['name'] . " [$from]", '%category' => $contact['category'])); + + // Fire the contact form trigger. + module_invoke_all('contact', $values); + + // Show message. drupal_set_message(t('Your message has been sent.')); // Jump to home page rather than back to contact page to avoid @@ -245,6 +250,11 @@ function contact_personal_form_submit($f flood_register_event('contact'); watchdog('mail', '%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)); + + // Fire the contact form trigger. + module_invoke_all('contact', $values); + + // Show message. drupal_set_message(t('Your message has been sent.')); // Back to the requested users profile page. Index: modules/trigger/trigger.module =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v retrieving revision 1.50 diff -u -p -r1.50 trigger.module --- modules/trigger/trigger.module 10 Oct 2009 16:48:38 -0000 1.50 +++ modules/trigger/trigger.module 10 Oct 2009 21:04:12 -0000 @@ -158,6 +158,14 @@ function trigger_trigger_info() { 'label' => t("When a user's profile is being viewed"), ), ), + 'contact' => array( + 'contact_site' => array( + 'label' => t('After completing the site contact form'), + ), + 'contact_personal' => array( + 'label' => t("After completing a user's contact form"), + ), + ), ); } @@ -604,3 +612,22 @@ function _trigger_get_all_info() { return $triggers; } +/** + * Implement hook_contact(). + */ +function trigger_contact($values) { + // Define hook type. + if (isset($values['contact'])) { + $hook = 'contact_site'; + } + else { + $hook = 'contact_personal'; + } + $aids = trigger_get_assigned_actions($hook); + $context = array( + 'group' => 'contact', + 'hook' => $hook, + 'form_values' => &$values, + ); + actions_do(array_keys($aids), (object) $values, $context); +}