[Resuelto] How to add a delete post link in a CRED edit form
Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
Client is trying to use the cred_delete_post_link in a CRED Edit form, but it is not working.
Solution:
You cannot insert the shortcode using the GUI in a CRED Edit form as it is not the expected use, but if formatted correctly and entered manually it will work, e.g.
[cred_delete_post_link action="delete" text="Delete %TITLE%" message_after="Post deleted" message="Are you sure you want to delete this post?" message_show="1"]
This support ticket is created hace 6 años, 8 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I recently added the following code to a CRED edit form:
[cred_delete_post_link text="Delete" message="Are you sure you wish to delete this skillset?" message_after="The skillset has been deleted." message_show="1"]
The link appears and when I click it, I am asked to confirm the deletion. However, when clicking OK the link changes to the text "Deleting.." and then doesn't do anything. I don't get a confirmation of deletion, the page doesn't change, and when I check the admin console the post has not been deleted.
I did see a link regarding a patch (see below) but it says this patch is to be overlaid onto version 1.9.4 and I am presently using 1.9.5. Furthermore, the problems do not seem to be identical, in that the patch discusses fixing a redirect problem.
I manually created the shortcode because honestly I couldn't find it anywhere in the GUI, but my wife says I have male pattern blindness so maybe it was there right in front of my face and just couldn't see it. Where exactly do you go to add it?
Regarding the patch, can you provide more clarity on where the cred_shortcode.js file lives? The instructions on installing the patch (https://toolset.com/errata/cred-delete-post-link-fails-redirect-specific-post/) say to upload the file to the "/public/js/" directory but I cannot find this exact patch in my site structure. I do not see a directory called public but do have one called public_html, but inside that I do not see a js directory. I do se a js directory using the path "/public_html/wp/wp-admin/js" or "/public_html/wp-admin/js" but neither of those directories have a file called cred_shortcode.js.
Aparently my male pattern blindness is getting me good on this particular issue! Let me know if I'm totally looking in the wrong spot. Cheers.
Thanks for clarifying. I was able to upload the patch. Based on your response, I think I may have figured out the issue. I was trying to add the delete link into the CRED edit form itself (i.e. where they go to edit their post). Perhaps the delete link can only live in either a view or a single post page?
- Aaron
[credform class='cred-form cred-keep-original']
[cred_field field='form_messages' value='' class='alert alert-warning']
<div class="form-group">
<label>Area of Skillset</label>
[cred_field field='subject' display='select' single_select="true" output='bootstrap']
</div>
<div class="form-group">
<label>Headline</label>
[cred_field field='post_title' post='user-skill' value='' urlparam='' class='form-control' output='bootstrap']
</div>
<div class="form-group">
<label>Brief Description of Details</label>
[cred_field field='post_excerpt' post='user-skill' value='' urlparam='' class='form-control' output='bootstrap']
</div>
[cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']
[cred_delete_post_link text="Delete" message="Are you sure you wish to delete this skillset?" message_after="The skillset has been deleted." message_show="1"]
[/credform]
Sorry, it's right there, the first line of your question that that is where you were inserting delete link.
It is not the intended/expected use—you can't insert the shortcode using the GUI—but in testing just now I found that it worked.
I went to a content template for displaying my single posts and used the GUI to generate the shortcode, and then I copied and pasted this into my CRED edit form, and it worked.
This is the shortcode in full:
[cred_delete_post_link action="delete" text="Delete %TITLE%" message_after="Post deleted" message="Are you sure you want to delete this post?" message_show="1"]