Accueil › Toolset Professional Support › [Résolu] urlparam in cred form submit dont redirect to the right post
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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
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)
Marqué : Content-submission forms, Toolset Forms
Documentation connexe :
Ce sujet contient 18 réponses, a 2 voix.
Dernière mise à jour par davidZ-4 Il y a 7 années.
Assisté par: Minesh.
I am trying to: redirect a user to a page with a view that except urlparam after clicking cred submit button
Link to a page where the issue can be seen:
lien caché
I expected to see:
the page with the post that is called by the urlparam
Instead, I got:
the user is redirected to the page without the urlparam and get the wrong post in the view
The page lien caché use a view to display one post using url param
In genral I point to the page and spacifc post to display by using the following in my <a> tag:
href="[wpv-post-url id="1684"]/?edi=[wpv-post-id]&edp=[wpv-post-id id="$education-parent"]"
and it work great.
in the view of the single custom post i display cred edit form of the post.
i set the cred redirect to the page called above.
in the cred form i set the submit butoon including the urlparam values as followed:
[cred_field field='form_submit' value='Submit' urlparam='edi=[wpv-post-id]&edp=[wpv-post-id id="$education-parent"]' class='btn btn-primary btn-lg btn-block' output='bootstrap'
the cred submit button display:
lien caché
when clicking the submit button the user is been redirected to:
lien caché
which display the wrong post.
please advise,
thanks,
David
Hello. Thank you for contacting the Toolset support.
First of all - After checking debug information you shared with us, I found that you are using outdated Toolset plugins. We always recommend to run your site with latest stable release plugin version.
*** Please make a FULL BACKUP of your database and website.***
Could you please update ALL Toolset plugins to it's latest official released version. You can download latest plugin release from your accounts page:
=> https://toolset.com/account/downloads/
Now, regarding your redirection issue, CRED offers redirection hook cred_success_redirect .
For example:
add_filter('cred_success_redirect', 'custom_redirect',10,3); function custom_redirect($url, $post_id, $form_data) { if ($form_data['id']==12) return '<em><u>lien caché</u></em>'; return $url; }
Where:
- You can adjust your URL according to your need.
More info:
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
Hi Minesh,
My toolset plugins are all updated to the latest version.
I think I know what happen. I updated the plugins after submitting the ticket and the issue still stand...
I'm not looking to redirect to a permanent url using the redirect hook but rather redirect to a page on my site that get the information of what post to show based on a urlparam passed in the url.
the view on the page know how to accept these.
it the cred form that do something wired even though the urlparam are passed when the submit button is clicked.
David
If you updated plugins - all fine , no issue with that.
I think I know what you mean, you want to redirect to same page but with different url param with different post id - correct? If yes, you can still use the 'cred_success_redirect' hook to redirect to same page with additional param you may have.
Do I understand your issue now? if now, I need problem URL to check whats going wrong there and info what should be your expected output.
*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Thank you for all details but when I try to visit following link:
=> lien caché
I do not see any submit button but it shows me message "No items found" - could you please tell me is anything going wrong with the setup?
Also, with above link I need info which post it should display, could you please share clear step and expected results information.
sorry here are the steps:
got to lien caché
click submit
expecting to view lien caché
instead getting lien caché
Thanks,
David
Could you please check now. I've added following code to your current theme's functions.php file:
add_filter('cred_success_redirect', 'func_redirect_to_page',10,3); function func_redirect_to_page($url, $post_id, $form_data){ if ($form_data['id']==1719){ return $_SERVER['HTTP_REFERER']; } return $url; }
Now, I can see the page is redirect back to same URL. Could you please confirm.
Thanks Minesh,
this is working great !
the bellow is related to a new post creation using cred form
one questions regarding the creation of a new post using a cred new post form and redirecting to the same location as above.
I would like the new education cred form lien caché to redirect in the same way to the same page.
is the following code will be correct?
add_filter('cred_success_redirect', 'func_redirect_to_page',10,3); function func_redirect_to_page($url, $post_id, $form_data){ if ($form_data['id']==1719 || $form_data['id']==1716){ return $_SERVER['HTTP_REFERER']; } return $url; }
I have tried the above and added the urlparam in the new education cred post but it doesn't work on my end. but it doesn't redirect to the new post that was created.
I would expect the redirect to point to:
lien caché POST ID]&edp=[PARENT POST ID]
any thoughts?
Thanks,
David
Could you please tell me where you've added the CRED form "Add education analysis" to create new education?
Sure,
follow the process:
go to lien caché
click on Education need analysis button- this will create the parent post and redirect you to create new child post (education) here:
lien caché
please note that I put all my custom code in the function.php file editable here lien caché
Thanks,
David
Well - you should keep all code (toolset hooks filters) whatever you have added to your current theme's functions.php file to make sure all working fine. Please do not move the code to another place as it will result in breaking something or it may have negative effect.
Please move code to your current theme's funcitons.php file and the FTP access details you shared were not working. Please share FTP access details.
Hi Minesh,
I have moved custom code to the theme function.php.
the FTP works on my end with the same credentials I provided.
please dont use a folder name in the ftp link. the folder name is a mandatory field in toolset so I wrote root folder but you dont need it so the ftp is the domain name I provided (including the subdomain name)...
Thanks,
David
Still - FTP not working for me. Do I need to use SFTP or any port to login to FTP?
May be you can create new user for me and send me access details with Host, username, password and port if any.
No still FTP access is not working. I get following message:
550 SSL/TLS required on the control channel Error: Could not connect to server
that's strange
I'm using FileZilla with the credentials above and its working
are you omitting the folder name in the ftp link?
use lien caché
not lien caché use a folder
David