DOCUMENTATION

Search »

Hooks Manager

Step 3: Creating the Hooks Manager rule

Editing
Editing "last emailed" rule

Last step is to create a new Hooks Manager rule that ties everything together. What this step does is append some custom PHP that's called whenever an email is sent to a particular submission. Specifically, it updates the new last_emailed field that you just added to the database and keep track of that info.

The code is actually quite simple. You can just copy and paste the following code into the Hooks Manager rule, as shown in the screenshot on this page:

The only change you'll need to make is change the $table_prefix variable to store your database prefix (this is found in your /global/config.php file).

Final Notes

The only deficiency of this method is that on the Edit Submission page, the "Email" feature sends the email via Ajax and doesn't instantly update the "Last Edited" field value displayed on the page. It will only be visibly updated when you return to the submission the next time. [Technically, you can solve this by writing a custom template hook... but that's another story!]