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