Skip Navigation

[Resolved] Delete image from CRED form add/edit media library popup

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

Problem:
I want users, especially those with a custom role created using Toolset Access, to be able to delete images directly from the media library popup when accessing it from a CRED form. This would allow users to manage their images effectively, particularly for scenarios like replacing images with larger versions and cleaning up unnecessary files.

Solution:
In WordPress, the ability to delete images from the media library is tied to user roles and capabilities. Users with the "delete_others_posts" capability typically have this privilege. You can test and adjust capabilities in Toolset Access settings to determine which ones grant users the ability to delete images.

Relevant Documentation:

Toolset Access Control: https://toolset.com/documentation/user-guides/access-control/
WordPress User Roles and Capabilities: https://wordpress.org/support/article/roles-and-capabilities/

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 3 replies, has 3 voices.

Last updated by Christopher Amirian 11 months, 3 weeks ago.

Assisted by: Christopher Amirian.

Author
Posts
#2681119
Screenshot 2024-02-01 at 23.15.05.png

Tell us what you are trying to do?

I'd like users to be able to delete images when using the media library popup from a CRED form.

So when they access the popup media library from the form - they can select an image and them delete it.

Allowing users (with a custom role using Toolset Access) - to mange their images/media files.

Use case:
I upload an image to use in a directory.
I then deicde I want to use a larger image - so I upload the larger image.
Now I want to clean up my files and delete the original image so I don't get mixed up and use it later.

Is there a way to make this happen using Toolset + Access?

Thank you

#2681440

Nigel
Supporter

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

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

Screenshot 2024-02-02 at 16.00.14.png

Hi there

If you edit a post in the back-end with the classic editor and you insert an image into the post via the media library, you will see a link to delete the image (screenshot).

If your Toolset Forms are set "Use the WordPress Media Library manager for image, video, audio, or file fields" then when inserting images in a form the same dialog appears, and the same delete link is included.

That's as an administrator.

What role is it that you intend this to work for? Does a user with that role see the delete link if they edit a post in the back end and insert an image into the post content?

#2681449

Thanks Nigel,

It is a custom user role created by toolset / access. As admin I can see the edit image and delete options when using the form.

What capabilities, permissions do they need in order to see this delete option?

I've tried delete_posts etc but nothing is making a difference at the moment.

What would I need to give them in Toolset Access settings?

Thanks

#2681658

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

In WordPress, the ability to delete images is typically tied to the user role and capabilities. Users with the "delete_others_posts" capability are usually allowed to delete images in the media library.

You can test the capabilities by going to Toolset > Access Control > Custom Role, enable "Advanced Mode" then click the Change Permissions under the custom role you have created and you can there check/uncheck the capabilities to test which one is responsible for that delete link.

It is a WordPress thing actually and not Toolset, so I am not sure exactly which capability can be the one responsible but usually it should be "delete_others_posts".

Thanks.