Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#53981 new defect (bug)

The 'media_buttons' hook does not work for contributors.

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


##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.

3 years ago

  • Keywords has-patch added

#2 @peterwilsoncc
3 years ago

  • Component changed from Editor to Media
  • Severity changed from major to normal
  • Version changed from 5.8 to 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.

3 years ago

Note: See TracTickets for help on using tickets.