Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#53981 new defect (bug)

The 'media_buttons' hook does not work for contributors.

Reported by: jamesros161 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Media Version: 2.7
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

##Problem Details##
Plugins are given the media_buttons hook to be able to add additional buttons to the editor interface. The way this is implemented in _WP_Editors::editor(), the user role must include the upload_files capability. While this makes sense when it comes the default Add Media button, it doesn't make sense for some other buttons such as Post And Page Builder's Add Block button, or WeForms' Contact Form buttons. The plugin developers should be able to decide what capabilites the user needs to have for their custom buttons before hooking into that action.

##Suggested Resolution##
My suggestion is that the existing media_buttons hook remain as it is, but that we add another hook just afterwards called after_media_buttons . This will allow those custom buttons to be rendered whenever the developer wishes them to be.

Change History (3)

This ticket was mentioned in ​PR #1612 on ​WordPress/wordpress-develop by ​jamesros161.


5 years ago
#1

  • Keywords has-patch added

#2 @peterwilsoncc
5 years ago

  • Component Editor → Media
  • Severity major → normal
  • Version 5.8 → 2.7

This permission check was introduced in [9660] in WordPress 2.7. I've also moved this to the media component for the team to review.

This ticket was mentioned in ​Slack in #core-media by antpb. ​View the logs.


5 years ago

Note: See TracTickets for help on using tickets.