The Contact Enhanced Custom Code plugin is a flexible plugin that allows you to write custom PHP code in order to change nearly any Contact Enhanced form behavior.
Write your PHP Custom Code and upload to the paths provided in the basic options. The PHP file will appear in the dropdown when it is uploaded to the proper path.
To utilize the CustomCode Plugin to append the Contact Name to the Subject line of the email that is sent to the admin recipient of the form follow these simple instructions;
1. Go to Extensions → Plugin Manager;
2. Either use the filter and enter or click on Contact Enhanced - Custom Code from the Plugin Manager list;
3. Enable the Plugin under Details;
4. Click on Basic Options and select Choose from the settings for onSubmitContact the prepend-contact-name-to-subject.php; This example was already added to the plugin
5. Click Save & Close;
6. Test from the front-end to verify working as desired;
If validation fails on either the onSubmitContact or onValidateContact, the script should assign the $exception to the $returns variable, then Contact Enhanced will return a validation error (you have to throw an Exception).
Tutorial written by Jennifer Gress <snapdragonservices.com>