Plugin Directory

Changeset 1384851


Ignore:
Timestamp:
04/02/2016 06:46:48 AM (10 years ago)
Author:
dsader
Message:

Update to Customizer menu toggle

Location:
menus/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • menus/trunk/ds_wp3_menus.php

    r802837 r1384851  
    33Plugin Name: Menus
    44Plugin URI: http://wordpress.org/extend/plugins/menus/
    5 Version: 3.7.1
    6 Description: WP3.7.1 Multisite "mu-plugin" to toggle more of the administration menus in the same way "Plugins" is already toggled. Go to Network-->Settings->Menu Settings to "Enable administration menus". All menus are unchecked and disabled by default, except when logged in as Network Admin.
     5Version: 4.3
     6Description: Wordpress Multisite Network plugin to toggle more of the administration menus in the same way "Plugins" is already toggled. Go to Network-->Settings->Menu Settings to "Enable administration menus". All menus are unchecked and disabled by default, except when logged in as Network Admin.
    77Author: dsader
    88Author URI: http://dsader.snowotherway.org
     
    3434add_action( 'admin_page_access_denied',  array(&$this, 'ds_access_denied_splash'), 99 );
    3535
     36
     37$menu_perms = get_site_option( "menu_items" );
     38    if( !isset($menu_perms[ 'app_cus' ]) ) {
     39add_action( 'admin_init', array(&$this, 'ds_customize'), 10 );
     40add_filter( 'init', array(&$this,'ds_removecustmizer_metacap'), 10 );
     41    }
     42
    3643}
    3744//------------------------------------------------------------------------//
    3845//---Functions to Enable/Disable admin menus------------------------------//
    3946//------------------------------------------------------------------------//
     47
     48function ds_customize() {
     49        remove_action( 'plugins_loaded', '_wp_customize_include', 10);
     50        remove_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings', 11);
     51        add_action( 'load-customize.php', array(&$this, 'ds_override_load_customizer_action') );
     52    }
     53function ds_override_load_customizer_action() {
     54        wp_die( __( 'The Customizer is currently disabled.' ) );
     55    }
     56function ds_removecustmizer_metacap() {
     57    add_filter( 'map_meta_cap', array(&$this,'ds_removecustmizer_metacap_filter'), 10, 4 );
     58
     59}   
     60function ds_removecustmizer_metacap_filter( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
     61    if ($cap == 'customize' ) {
     62        return array( 'nope' ); //thanx wp-crap
     63    }
     64    return $caps;
     65}
     66
    4067function ds_access_denied_splash() {
    4168    //redirects WP "You do not have sufficient permissions to access this page." to dashboard or add custom message instead.
     
    88115    }
    89116
    90     if( !isset($menu_perms[ 'jetpack_jetpack' ]) && current_user_can('manage_options')) {
     117    if( !isset($menu_perms[ 'jetpack_jetpack' ]) && current_user_can('jetpack_manage_modules')) {
    91118        remove_submenu_page( 'jetpack', 'jetpack' );
    92119        if( strpos($_SERVER['REQUEST_URI'], 'jetpack'))     
    93120            { wp_redirect( $redirect ); exit(); }
    94121    }
     122
     123
     124    if( !isset($menu_perms[ 'jetpack_modules' ]) && current_user_can('manage_options')) {
     125        remove_submenu_page( 'jetpack', 'jetpack_modules' );
     126        if( strpos($_SERVER['REQUEST_URI'], 'jetpack_modules'))     
     127            { wp_redirect( $redirect ); exit(); }
     128    }
     129
    95130
    96131    if( !isset($menu_perms[ 'jetpack_akismet_key_config' ]) && current_user_can('manage_options')) {
     
    107142
    108143}
     144
     145
     146
    109147
    110148function ds_reduce_favorite_actions ($wp_toolbar) {
     
    332370
    333371    // 'Appearance Customize'
    334     if( !isset($menu_perms[ 'app_cus' ]) && current_user_can('edit_theme_options')) {
    335         remove_submenu_page( 'themes.php', 'customize.php' );
     372    if( !isset($menu_perms[ 'app_cus' ]) && current_user_can('edit_theme_options')) {
     373        if(!empty($submenu['themes.php'])) {
     374        foreach($submenu['themes.php'] as $key => $sm) {
     375            if(__($sm[0]) == __('Customize') || $sm[2] == "customize.php") {
     376                unset($submenu['themes.php'][$key]);
     377                break;
     378                }
     379            }
     380        }
    336381        if( strpos($_SERVER['REQUEST_URI'], 'customize.php'))   
    337382            { wp_redirect( $redirect ); exit(); }
    338383    }
     384
    339385   
    340386    // 'Appearance Widgets'
     
    359405    }
    360406
     407    // 'Appearance Header'
     408    if( !isset($menu_perms[ 'app_back' ]) && current_user_can('edit_theme_options')) {
     409        remove_submenu_page( 'themes.php', 'custom-background' );
     410        if( strpos($_SERVER['REQUEST_URI'], 'custom-background'))   
     411            { wp_redirect( $redirect ); exit(); }
     412    }
     413   
    361414    // 'Plugins Plugins'
    362415    if( !isset($menu_perms[ 'plug_plug' ]) && current_user_can('activate_plugins')) {
     
    501554            'menu_jetpack'      => __('Jetpack'),
    502555            'jetpack_jetpack'   => __('Jetpack Jetpack'),
     556            'jetpack_modules'   => __('Jetpack Settings'),
    503557            'jetpack_akismet_key_config'    => __('Akismet'),
    504558            'jetpack_akismet_stats_display' => __('Akismet Stats'),
     
    527581            'app_men'       => __('Appearance Menus'),
    528582            'app_head'      => __('Appearance Header'),
     583            'app_back'      => __('Appearance Background'),
    529584            'plugins'           => __( 'Plugins' ),
    530585            'plug_plug'                 => __('Plugins Plugins'),
  • menus/trunk/readme.txt

    r1384628 r1384851  
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 A Multisite Network plugin to toggle adminstration menus for the entire network of sites.
     11A Multisite Network plugin to toggle administration menus for the entire network of sites.
    1212
    1313== Description ==
    14 Enable or disable WordPress [Multisite](http://codex.wordpress.org/Create_A_Network) Backend Menus. Adds options to toggle administration menus at Network Admin->Settings page under "Menu Settings". WP3 already toggles the Plugins menu, I've added a bunch more in the same/similar way.
     14Enable or disable WordPress [Multisite](http://codex.wordpress.org/Create_A_Network) backend menus. Adds options to toggle administration menus at Network Admin->Settings page under "Menu Settings". WP already toggles the Plugins menu, I've added a bunch more in the same/similar way.
    1515
    16 I use the plugin to simplify the menus available to the entire network of sites. I use this plugin in a WP3.5 Multisite installation to disable the Deltete Blog, Permalinks, Import, Add Users and Themes menus.
     16I use the plugin to simplify the menus available to the entire network of sites. I use this plugin in a Multisite installation to disable the Delete Blog, Permalinks, Import, Add Users and Theme customizer menus.
    1717
    1818The plugin also removes some of the admin bar menu items as well.
     
    2323
    24241. Upload the plugin to your blog, Network Activate it
    25 2. Set multisite "Menu Settings" option at Network->Settings page
     252. Set multisite "Menu Settings" options at Network->Settings page
    2626
    2727== Frequently Asked Questions ==
    2828
    2929* Will this plugin also hide menus added by plugins? Maybe, if the parent page is hidden. Snoop into the code to see how to add your own remove_menu_page items.
    30 * Will this plugin hide the corresponding items from the admin head favorites and toolbar? Yes. The +New and a couple others can be toggled
     30* Will this plugin hide the corresponding items from the admin head favourites and toolbar? Yes. The +New and a couple others can be toggled
    3131* Will this plugin disable media uploads? Yes. Well, from the Media menus at least.
    3232* Will this plugin hide the media upload buttons? No. The Media Upload Buttons in the edit post/page form can be removed with my Toggle Meta Boxes Sitewide plugin.
    33 * Can I have different menus for different roles of users on different blogs? No, this plugin toggles menus for all users and all blogs regardless of Cap/Role (only SuperAdmin can overide the limits of the plugin however).
     33* Can I have different menus for different roles of users on different blogs? No, this plugin toggles menus for all users and all blogs regardless of Cap/Role (only SuperAdmin can override the limits of the plugin however).
    3434
    3535== Screenshots ==
    3636
    37 1. Menu Settings: Enable Adminstration Menus
     371. Menu Settings: Enable Administration Menus
    38382. Admin Bar Dropdown Shortcuts
    3939
    4040== Changelog ==
     41= 4.3 =
     42* Tested up to: WP 4.5, hides Customizer by default, enable @ Network->Settings
     43
    4144= 3.7.1 =
    4245* Tested up to: WP 3.7.1 major rewrite for 3.7.1
    4346
    4447== Upgrade Notice ==
    45 = 3.7.1 =
    46 * Tested up to: WP 3.7.1
     48= 4.3 =
     49* Tested up to: WP 4.5, hides Customizer by default, enable @ Network->Settings
Note: See TracChangeset for help on using the changeset viewer.