[Resolved] Several cred_success_redirect instances in project worked at first but don’t now
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I’m hoping for help understanding how it’s happening that some, but not all, of the forms I’m using the cred_success_redirect hook for in a project have stopped performing as expected. They were working, but at some point they stopped. Unfortunately, it took me a while to notice the change, and I can’t identify anything I might have done elsewhere in the project that might be a related factor. The functions for triggering the redirects in question themselves haven’t been changed, and when I test them by including an error_log() line in them, I can see that they’re being called. It’s just that the specified redirect isn’t being effected when the hook fires.
Just to reiterate, there are several uses of the hook in the project, all set up the same (with ‘Display the post’ option selected in form settings), and though all were working as expected and none has been changed, two of them no longer work.
It may be relevant that the two forms for which redirects no longer take effect are more involved than the others, with more data being saved. But I’m not sure what to test to understand whether or how this could be a factor.
Hello. Thank you for contacting the Toolset support.
Can you please tell me for what form what "cred_success_redirect" hook you added is not working as expected.
Please share all required information that should help me to see the issue and share admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
It looked like my reply would post as a restricted-view message, as you indicated, but once it was submitted it was a public-view message instead. I don’t know why. There was no warning of a change of privacy status.
I have removed the content of the reply initially made. I need to give you additional user information. Can the option to give you that information privately be reset?
My initial reply has again been published for public view in spite of the private-view option being selected. Is it possible to send you the additional private-view information by email?
Hi Minesh, I have edited the May 29 private post, above, to include the additional information requested. Private-post status does not appear to be retained on any replies subsequent to that one.
I see you set the above form to go to the option "Test page" for the form setting "After visitors submit this form:".
I would like to know - are you using cred_success_redirect hook anywhere or once the form is submitted you would like to redirect user to "test page" you set from the form setting "After visitors submit this form:"?
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
If yes:
Where you added the "cred_success_redirect" code?
In addition to that I also see you are using "Redirection" plugin:
In order to minimize the cause of the issue - have you checked for any possible conflict between plugins/theme you are using:
Could you please try to resolve your issue by deactivating all third-party plugins as well as the default theme to check for any possible conflicts with any of the plugins or themes?
- Do you see any difference?
Updated: Also I do not able to see the screenshots you shared.
Yes, the cred_success_redirect function hook is used in several function calls, all of which are located in a single plugin. Only two of these are in question. The redirect function for the form you refer to here is in jobs-mgmt-jobs.php in that plugin. The other one is in jobs-mgmt-tasks.php. (This information is in my private reply above, toward the beginning of the reply, but I see now that this wasn’t as clear as it could have been. I’ve edited that part of the private reply to make it clearer, hopefully.)
I have included the screenshots in this post now. They were being lost from the private reply when I tried to add them in an edit to the post. I don’t know why.
I should have thought to check for any obvious plugin conflict before starting this ticket, but I had not. Thank you for prompting me to do this, Minesh.
I was able a short while ago to do a basic test as you recommend, deactivating our theme as well as all plugins except for the Toolset plugins (and, of course, the simple plugin that we’re using as container for our own functions, the majority of which are set on Toolset hooks, the two cred_success_redirect functions in question among them). Deactivating all apart from the Toolset essentials did not result in any change. The expected redirect did not follow when test submissions were made with the two problem forms.
And added the same code to "Custom Code" section offered by Toolset:
- hidden link
And I find it working when I submit the new job.
It seems the hook "cred_success_redirect" requires some asses while it runs and as you added to the separate plugin its not working as expected. So to make it work better you should add it to "Custom Code" section.