[wp-trac] [WordPress Trac] #20111: Ability to set permission level for admin settings pages using filters

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 24 15:36:26 UTC 2012


#20111: Ability to set permission level for admin settings pages using filters
-----------------------------+-----------------------------
 Reporter:  bananastalktome  |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Administration   |    Version:
 Severity:  normal           |   Keywords:
-----------------------------+-----------------------------
 Removing admin pages from the menu tree is made possible through using
 either the `$submenu` global or the `remove_submenu_page` function,
 however preventing users from manually accessing the page is not an easy
 endeavor (afaik). Rather than hard-coding in the minimum role, would it
 make better sense to utilize filters to allow developers to change the
 privilege?

 For example, a change on line 13 of `wp-admin/options-discussion.php`:

 {{{
 - if ( ! current_user_can( 'manage_options' ) )
 + if ( ! current_user_can(
 apply_filters('admin_options_discussion_page_privilege', 'manage_options')
 ) )
 }}}

 Removing access to this page would then be as easy as
 `add_filter('admin_options_discussion_page_privilege', create_function('',
 'return "manage_network";'));` , for example.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20111>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list