How to Trigger a Notification from a Toolset Types Front-end Form
Updated
If you use Toolset Types Forms and want to trigger a notification off of a front-end form, you’ll need to do so using their Forms/Cred API.
To do this:
1. Ensure the post is saved as a draft.
2. Create a custom page template that contains this code (replacing XX with your form ID, where needed):
1 2 3 4 5 6 7 8 9 10 | function my_success_action($post_id, $form_data) { if ($form_data['id'] == XX) { $cur_post = array( 'ID' => $post_id, 'post_status' => 'publish' ); wp_update_post($cur_post); } } add_action('cred_submit_complete', 'my_success_action', 10, 2); |
3. In the settings of the Toolset Form, set a delay of 1 second for the redirection of the form after submission.