I want to store custom data based on computation of newly updated post data in a custom table.
Sequence: 1) enter data in cred post form, 2) submit cred post form 3) standard tables get updated 4) I run my code to compute data from the updated standard tables to store in a custom table AFTER specific forms are submitted.
I want the code to be triggered after the cred post form is submitted but I don't want the code to delay the redirection from the form i.e. user should not be have to wait while this code runs. It could run in the background and do it's job and user can continue with their work.
My question: What is the right hook to use here that allows me to trigger the code after a specific form submit? I can't use cred_success_redirect as it will delay the user experience. Is there another hook I can use that allows me to filter execution by cred form id?
I think I did not explain the issue clearly. I want to be able to trigger custom code after the post has been published and the user has been directed to the new page (if that's the case) or has received a message in the form.
If I use the cred_submit_complete hook, it will stall the redirection until my code is executed. I don't want that. I want the user to continue using the site while this custom code is triggered in the background AND I want the code to be triggered only when a specific form id is submitted.
I had another thought on using the on-demand feature of the toolset custom code to trigger the action.
What if I add the script to the URL parameter when redirection happens? This way the user gets redirected to the post and I append the script as a URL parameter to the post URL.
Link here: hidden link
My question: will the redirection of the user the post get delayed until this script in the URL is processed?
This can work however how will you be adding it to the URL? using the redirect hook ?
Any extra code will have a delay effect on the redirection since adding the url parameter is before the return statement. There will be delay but if it will be a noticeable delay I believe not.
This will then allow you to fire your custom code after the redirect is done since it is listening for the URL parameter.