WordPress.org

Make WordPress Core

Changeset 17987


Ignore:
Timestamp:
05/22/2011 09:32:44 PM (9 years ago)
Author:
nacin
Message:

Leverage option_page_capability_* filter in Twenty Eleven. fixes #14365.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/inc/theme-options.php

    r17959 r17987  
    5454}
    5555add_action( 'admin_init', 'twentyeleven_theme_options_init' );
     56
     57/**
     58 * Change the capability required to save the 'twentyeleven_options' options group.
     59 *
     60 * @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.
     61 * @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
     62 *
     63 * By default, the options groups for all registered settings require the manage_options capability.
     64 * This filter is required to change our theme options page to edit_theme_options instead.
     65 * By default, only administrators have either of these capabilities, but the desire here is
     66 * to allow for finer-grained control for roles and users.
     67 *
     68 * @param string $capability The capability used for the page, which is manage_options by default.
     69 * @return string The capability to actually use.
     70 */
     71function twentyeleven_option_page_capability( $capability ) {
     72    return 'edit_theme_options';
     73}
     74add_filter( 'option_page_capability_twentyeleven_options', 'twentyeleven_option_page_capability' );
    5675
    5776/**
Note: See TracChangeset for help on using the changeset viewer.