Skip Navigation

[Resolved] Is there a CRED shortcode for changing a post status e.g. to "draft"

This support ticket is created 4 years, 7 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by PaulS4783 4 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1596733

I have a content template that uses the "Delete Post" CRED shortcode.
[cred_delete_post_link class='listing-trash-button cred-refresh-after-delete text-danger' text='Delete' action='trash']

Its problematic to give that level of functionality to users.
Instead, I'd like to give users the ability to change the "Post Status" to "draft".
Is there a shortcode for that?
Or can you recommend a code snippet to create a custom shortcode?

I

#1597669

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

Thank you for getting in touch.

Actually there is a simpler way of doing this and it can be done with just our CRED plugin.

What you need to do is to create an edit form for that post type. Set the form setting for Post Status to "Draft". Then remove all the fields from your form except the submit button.

Form there you need to save your form and then just add your form to the page.

What will happen is that the user will see the button and when clicked it will change the post status to draft.

Please let me know if this helps.
Thanks,
Shane

#1598463

OK! That works for me.
Very clever solution.

One thing maybe I need though.
It would be nice to get a warning message after clicking the "Submit" button on the form.
Something like "Are you sure you don't want to run this listing any longer?"

Is that possible within ToolSet, without resorting to custom code?

#1599511

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

Regarding this "Are you sure you don't want to run this listing any longer?"

Unless you add it to the form as a static text then no it wont be possible without custom coding.

Thanks,
Shane

#1601133

You can mark this ticket solved.

Added a little jQuery script to force a "confirmation" dialogue on the Submit button.

jQuery(document).ready(function( $ ){
$(function() {
$('form.cred-form input.form-submit').click(function() {
return window.confirm("Are you SURE you want to cancel your listing?");
});
});
});