#44581 closed enhancement (fixed)
users without 'edit_posts' capability never get informed that their uploads succeed
Reported by: | pbiron | Owned by: | joemcgill |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch has-screenshots commit |
Focuses: | Cc: |
Description
Steps to reproduce:
- create a user with
upload_files
capability but notedit_posts
capability - login as that user
- upload a media file
- notice that the status of the upload stays at
Crunching...
- notice also that the filename/post_title eventually ends up blank
Expected behavior:
- user gets some sort of "Success" notification (analogous to the
Edit
link that users withedit_posts
capability get)
I discovered this problem on a site with users whose role is basically Subscriber
but with upload_files
capability. The problem is that /wp-admin/async-upload.php
contains:
<?php if ( ! current_user_can( 'edit_post', $id ) ) wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
My current workaround is to hook into user_has_cap and add edit_posts
IFF edit_post
is being checked from async-upload.php
and its an attachment whose post_author
is the current user. This workaround is not ideal (because I don't want these users to be able to edit the attachment), but at least they know the upload succeeded.
Attachments (5)
Change History (29)
@
7 years ago
this is what users without 'edit_posts' capability see after their upload has succeeded after 44581.diff is applied
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
6 years ago
#5
follow-up:
↓ 12
@
6 years ago
- Milestone changed from Awaiting Review to 4.9.9
- Owner set to joemcgill
- Status changed from new to reviewing
I want to take a hard look at the capabilities changes to make sure there aren't any issues with this change, but seems sensible.
This ticket was mentioned in Slack in #core-media by mike. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
5 years ago
#12
in reply to:
↑ 5
@
5 years ago
Replying to joemcgill:
I want to take a hard look at the capabilities changes to make sure there aren't any issues with this change, but seems sensible.
Just to be clear, the patch does not change any caps...it simply removes the wp_die()
when the user doesn't have edit_posts
and instead outputs something different in that case.
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
5 years ago
#15
@
5 years ago
- Keywords 2nd-opinion needs-testing added
- Milestone changed from 5.3 to Future Release
Refreshed the patch in 44581.2.diff.
As we're right before beta for 5.3 and this hasn't seen movement, moving this to Future Release.
Am interested in seeing this fixed, but would appreciate someone double-checking that nothing unintentional happens when removing the wp_die()
noted.
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-media by pbiron. View the logs.
5 years ago
This ticket was mentioned in Slack in #core by david.baumwald. View the logs.
5 years ago
#21
@
5 years ago
- Keywords 2nd-opinion needs-testing removed
Thanks for the patch @pbiron. Works as expected on a clean install!
this is what users without 'edit_posts' capability see after their upload has succeeded