Skip Navigation

[Resolved] Form not behaving as expected

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.

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 8 replies, has 2 voices.

Last updated by jamesR-13 1 year, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2550477

I have a form that should display the post it is creating once it is submitted, and it has been working as expected until today. I am not sure what changed, but now instead of displaying the post, it just shows the form again. Please enable private fields on this one.

#2550839

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As requested - I'm enabling the next reply as private.

Can you please share problem URL where I can see the issue as well as what form you are using.

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

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

#2551143

Minesh
Supporter

Languages: English (English )

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

I can see the issue - in order to ensure there is no conflict with the theme you are using or plugins:
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?

#2551187

No difference, same behavior with all plugins deactivated.

#2551743

The site has been working perfectly for over a year now. The only recent change was the duplication of a form (not the form in question) to create an edit form from it. There is only one function in the functions.php that hooks into the form in question. I have rolled back to the previous version of the theme and tested (same behavior persists), but I can't just switch to a different theme as there is quite a bit of php that makes the system work for other forms and views. But, again, to reiterate, the system has been working up until very recently, and I have already tested the form with all non-toolset plugins disabled, and it is still not behaving correctly.

#2551757

Minesh
Supporter

Languages: English (English )

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

The issue is not due to Toolset but due to the Toolset form hook which is having wrong code:

In your current theme's functions.php file - following code you have added:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==9201)
        $bb_post = toolset_get_related_post($post_id, array( 'bb', 'req-item' ));
        $bb_post_url = get_permalink($bb_post);
        return $bb_post_url ;
    return $url;
}

Can you change the above code as as given under and replace the above code:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==9201) {
        $bb_post = toolset_get_related_post($post_id, array( 'bb', 'req-item' ));
        $url = get_permalink($bb_post);
    }
    return $url;
}

Can you confirm the above solution help you to fix the issue.

#2551763

The form that is not working correctly is ID 11.

I have completely removed the code you mentioned, and form 11 is still not working correctly.

#2551765

Minesh
Supporter

Languages: English (English )

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

I would like to have bit history of this form here. Is the form with ID 11 is newly created or is it duplicated using another form?

#2551791

I'm not sure why but the functions.php wasn't being saved with the code you pointed out being removed, so I went into the server and made the edit and now it is working correctly. Thank you for your help.