Skip Navigation

[Closed] How can I add a confirmation dialog prior to deleting a 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.

This topic contains 6 replies, has 2 voices.

Last updated by Waqar 1 month, 2 weeks ago.

Assigned support staff: Waqar.

Author
Posts
#2384949

Tell us what you are trying to do? I'm trying to add a delete post link to a page displaying a series of custom posts.

Is there any documentation that you are following? CRED documentation & shortcodes

Is there a similar example that we can see? If you log into this site (you already have full access, etc. from prior tickets). Visit hidden link and make a new quote. Next, hit the delete button for that quote to delete it. CRED is not producing any dialog or confirmation message prior to deleting the post. Can you tell me how to add this functionality?

What is the link to your site? hidden link

#2385225

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

In Forms 2.5.6, some code refactoring for performance was made and the older "cred_delete_post_link" shortcode, was replaced by the new shortcode "cred-delete-post":
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-post

The confirmation dialog feature was available in the older shortcode but not in the new one.

Example of the old shortcode usage:


[cred_delete_post_link class='cred-refresh-after-delete' text='Delete' message='Are you sure you want to delete this post?' message_after='Post deleted' message_show='1' action='trash']

Although the older shortcode and its confirmation dialog feature work at the moment, since, it has been replaced by a newer one, it is possible that it gets completely depreciated in future releases. Hence, the old shortcode should only be used, if the confirmation dialog feature is absolutely required.

regards,
Waqar

#2385611

It seems buggy. It does display a confirmation. When I click OK, it displays the deleting... text in the delete button, followed by another dialog box stating that the post has been deleted with an OK button. After clicking that OK button, the page does not reload, so the post remains visible, including the 'Deleting..." text on the button until I manually reload the page.

Is there an example of code that would allow me to manage the JavaScript for this function?

#2386433

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

On my test website, I'm seeing a different behavior and the page automatically refreshes, after clicking the 'Ok' button for the post deleted dialog.

Are you seeing any errors In the browser's console? Can you please share the link to the page where this delete post link can be seen?

#2401551

I switched it back to the new version which has no confirmation because I needed to do a client demo. I just need a way to confirm deleting quotes before deleting them. The buggy stuff happens when I use the legacy version. I'm not demoing it anymore, so fgeel free to change it to see the issue.

#2401839

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update, but, I'm not seeing any option to add or delete quotes on the 'Rep Interface' interface page.

I'll assume that I'll have to be logged in to do that and you're welcome to share temporary admin login details, in reply to this message.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

#2403611

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the access details, but, I'm getting the "Unknown email address" message.

Can you please check the username and password again?

I've set the next reply as private.

The topic ‘[Closed] How can I add a confirmation dialog prior to deleting a post’ is closed to new replies.