Hello,
Is there any way to register when a post type is deleted by the user through frontend?
I have a members area where the users can add, edit or delete the post types related to them. The post types can be deleted trough a delete link on a view.
Thanks
There's not a way to trigger email notifications with a "Delete post" link, only with an actual CRED form. You could use an Edit Post CRED form to accomplish something similar:
- Create an Edit Post CRED form
- Choose status "Draft"
- Autogenerate the form
- Delete all the fields from this generated content except the form messages and submit button fields:
[credform class='cred-form cred-keep-original']
[cred_field field='form_messages' value='' class='alert alert-warning']
[cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']
[/credform]
- Change the text "Submit" to say "Delete Post" or something similar.
- Add your email notification to be sent when the form is submitted.
- Insert this CRED form instead of your delete post link.
Of course, this only sets the post status to "Draft". If you want to trash the post, you must use the cred_save_data API to set a different post status:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data