Skip Navigation

[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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 10 replies, has 2 voices.

Last updated by Minesh 5 months, 2 weeks ago.

Assisted by: Minesh.

Author
Posts
#2699882

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.

#2699917

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#2700128

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URLs where I can see those forms you mentioned.

I have set the next reply to private which means only you and I have access to it.

#2700213

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?

Thank you.

#2700300

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I have set the next reply to private which means only you and I have access to it.

#2700330

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?

#2700739

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.

#2700961

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

With the following form:
- hidden link

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.

#2701025
Screenshot 2024-05-30 at 13-28-03 Lodge Foundation – Interpreters’ Cooperative of Madison.png
Screenshot 2024-05-30 at 13-28-31 Lodge Foundation – Interpreters’ Cooperative of Madison.png
Screenshot 2024-05-31 at 09-14-42 jobtmp0003 Midvale DPH 7_Jan_2024 “Neighborhood Mental Health Awareness Kickoff” – Interpreters’ Cooperative of Madison.png
Screenshot 2024-05-31 at 09-15-13 job create job-task – part A – Interpreters’ Cooperative of Madison.png

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.

#2701160

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.

#2701218

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

After many tests - I've comment out the following code in jobs-mgmt-jobs.php file.

function icm_client_job_create_uploads_redirect( $url, $post_id, $form_data ) {
	
if ($form_data['id']==1070) {
  $client_parent = esc_html( $_GET[ 'parent_client_id' ] );
  if ( isset( $_POST[ 'job-add-files' ] ) ) {
    $url = site_url() . '?post_type=job&p=' . $post_id . '&preview=true&content-template-id=7563&pg_display_context=iframe_display';
  } else {
    $url = get_permalink( $client_parent );
	//$url = '<em><u>hidden link</u></em>';
	
	 wp_redirect( $url );
  
        exit;
	//exit;
  }
  error_log( 'icm_client_job_create_uploads_redirect fired', 0 );
}
  return $url;
}
add_filter( 'cred_success_redirect', 'icm_client_job_create_uploads_redirect', 10, 3 );

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.

More info:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/#adding-custom-php-code-using-toolset

#2701262

I have implemented this solution successfully with the other redirect function now.

Thank you very much for your patient help here, Minesh. This is a significant breakthrough for me in understanding how to think about using Toolset.