[wp-trac] [WordPress Trac] #19834: More Robust Capabilities for Attachments
WordPress Trac
noreply at wordpress.org
Sat Nov 24 15:08:50 UTC 2012
#19834: More Robust Capabilities for Attachments
-----------------------------+------------------------------
Reporter: walkinonwat3r | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: needs-patch |
-----------------------------+------------------------------
Changes (by barrykooij):
* cc: b.kooij@… (added)
Comment:
I would also really like to see custom capabilities for managing media.
In my case I've got a CPT with custom capabilities. The role only has
permission to view/edit/delete these CPT items, but must also be able to
manage media items (featured image, but also deleting previous uploaded
images in the media library). The only option at the moment is granting
the role access to editing posts, what I don't want to.
I've edited @dennisderoo code to let a role manage media items when he has
the permission to upload files (upload_files):
{{{
public function fix_media_permissions() {
global $wp_post_types;
$wp_post_types['attachment']->cap->edit_post = 'upload_files';
$wp_post_types['attachment']->cap->delete_posts = 'upload_files';
}
add_action( 'admin_init', 'fix_media_permissions' );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19834#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list