Skip Navigation

[Resolved] Delete others posts certain post type

This support ticket is created 3 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 3 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1780077
view.PNG
delete.PNG
user.PNG
access.PNG

Hi - I have a custom post type called Quick Links. I want one particular user (User A) to be able to create, edit and delete quick links. This user must otherwise remain a subscriber.

- I created a Toolset form to create new Quick Links (and gave User A access via Access).
- I created a Toolset Edit form to edit Quick links and set the access for User A following these instructions - https://toolset.com/course-lesson/controlling-access-to-front-end-forms/
- I added a delete link following these instructions - https://toolset.com/course-lesson/deleting-content-from-the-front-end/ and set access to User A.

Note - I set the access control in the Post Forms Front End Access but instead of giving a role access i gave it to the specific user (see screenshot user.png).

This all works perfectly, the issue is that User A can now only delete quick links she has created. There may be instances where for example one of the site admins has created a link in her absence and User A then needs to delete it at a later date. I see that you can enable the option "delete others post using Toolset forms" which on the surface would fix it. But my concern is does that then mean User A can delete any post where the delete link has been added. For example I will be creating a similar set up where a different user (User B) can create, edit and delete Jobs (using a custom post type called Jobs, a create and edit form etc). Will User A also be able to delete Jobs (Created by User B) if I enable the "delete others post using Toolset forms" option?

I want User A to be able to delete her own and others posts but ONLY of the post type Quick Links. Is this possible?

Thanks!

#1780847

Hello,

Yes, it is possible to allow User A to delete her own and others "Quick Links" posts.

And I have tried it in my localhost(Fresh WP installation + the latest version of Toolset plugins) using the same settings as your screenshots, it works fine.

So the problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

4) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1781501
2..PNG
1.PNG
setup.PNG

Hi Luo - sorry maybe i wasn't 100% clear. The settings work as expected (see screenshot for what I have done). I.e User A can now delete her own and others quick links.

What I'm unclear on is ...

1. To allow "User A" to EDIT her own and others "Quick links" I created an Edit Form and added "User A" to the "Edit Others/Own Custom Post with the Form "Edit TD Quick Link" columns.

This makes sense because I specifically created a form which allows her to edit this content type and no other. But there is no option to create a Delete form.

2. So instead I added this shortcode to the view [cred-delete-post action='trash' onsuccess='self' class='small-green']Delete[/cred-delete-post] this adds the delete link and then in Access selected the option "Delete Others / Own Posts using Toolset Forms" and added User A which allows her to see the delete link

What I'm concerned about is that I think this means User A can delete any content on the site where the [cred-delete-post action='trash' onsuccess='self' class='small-green']Delete[/cred-delete-post] has been added but I "ONLY" want her to be able to delete Quick Links.

So for example there is a Jobs posts content type which another user is able to create and delete using Toolset Forms and Access. Does this mean User A will also be able to delete the Jobs posts because "Delete Others / Own Posts using Toolset Forms" doesn't actually specify the content type.

Thanks!

#1783559

Yes, you are right, that means User A will also be able to delete the Jobs posts too.

In your case, you can use wpv-conditional shortcode to check if current post type is "Quick links", then display the delete form link, for example:

[wpv-conditional if="( '[wpv-post-type]' eq 'quick-links') "]
[cred-delete-post action='trash' onsuccess='self' class='small-green']Delete[/cred-delete-post]
[/wpv-conditional]

Please replace "quick-links" with "Quick links" post type slug

More help:
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/

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