Skip Navigation

[Resolved] Redirect to view instead of post

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 5 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1231260

How do I edit the 'submit' button for a cred form to take me back to where I was on the frontend when I clicked the edit post button? It keeps taking me to the specific post after I click submit (save) and I see no way to change it to redirect to what page I was on originally (I'm showing posts inside a view and I want to stay in this view even after I edit the post).

Thanks!

#1231302
go-to-a-page.JPG

Hello,

You can try to edit your Toolset post form, in section "Settings", option "After visitors submit this form" choose "Go to a page", and select the specific page.

See screenshot go-to-a-page.JPG

#1231308

That won't work unfortunately because each user will need to go back to a differently named page.

If I make a view that has posts in it, and each post in this view loop has an edit button to a cred form, I want to be able to edit that post and and have it take me back to that view once I click submit instead of taking me to the specific post. This view will vary based on who is editing. That's the catch. So really, it should just take the user back to wherever they were before before they clicked the edit button.

#1231342

Unfortunately, there isn't such a built-in feature within Toolset forms, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Our developers will evaluate it.

You might consider custom codes.

Here are my suggestions, for example:
1) In a page (Page A) with the posts view, user click the edit button, it redirects to another URL with Edit post form, here you can:
- Create a custom shortcode to get the URL of "Page A"
https://codex.wordpress.org/Function_Reference/add_shortcode
$_SERVER['HTTP_REFERER']
hidden link
- Add a generic hidden field "from-url" in your Edit post form, use above shortcode to populate generic hidden field's value:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_generic_field

2) After user submit the Edit post form, use filter hook "cred_success_redirect" to trigger a PHP function
In this PHP function, do these:
1) Get the field "from-url" value:
hidden link
$_POST['from-url']
2) Change the redirect URL to above value

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect