Skip Navigation

[Resolved] How to add a delete post link in a CRED edit form

This thread is resolved. Here is a description of the problem and solution.

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 6 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by aaronM-9 6 years ago.

Assisted by: Nigel.

Author
Posts
#627989

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.

Any help would be appreciated. Thanks!

#628189

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Aaron

I just tested this locally. At first I couldn't reproduce it, but then I copied the exact same parameters from your example and found the same result.

In my initial test where I inserted the shortcode using the CRED button and set a few options within the GUI I found that it worked as expected.

So, can I first ask if you manually created the above shortcode, or if you inserted it with the GUI?

Also, please go ahead and apply the patch, the fix didn't make it into 1.9.5, it will be included in 1.9.6.

#628287

Hi Nigel,

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?

- Aaron

#628299

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.

- Aaron

#628303

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screen Shot 2018-03-26 at 12.45.00.png

So that's what my son-who-can-never-find-his-coat's condition is called.

The file location is inside the plugin folder, so site.com/wp-content/plugins/cred-frontend-editor/public/js.

In the GUI you can insert the CRED delete post link using the CRED Forms button on the editor.

#628305

Hi Nigel,

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]
#628648

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

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"]
#628712

Thanks for the help!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.