diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-08-08 16:08:52 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-08-08 16:08:52 +0000 |
| commit | e803779a9219e31c4f5705f6dbf40cf503b83b2f (patch) | |
| tree | f3727e140bcb108e2c03a36400b263e1989d541a | |
| parent | 8f31d8af4fc2c240363959c45ff893a70a87934f (diff) | |
Add Menu Backend options so backend pages can be disabled site-wide.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@141 7be80a69-a1ef-0310-a953-fb0f7c49ff36
| -rw-r--r-- | wp-inst/wp-admin/menu.php | 10 | ||||
| -rw-r--r-- | wp-inst/wp-admin/plugins.php | 8 | ||||
| -rw-r--r-- | wp-inst/wp-admin/wpmu-edit.php | 1 | ||||
| -rw-r--r-- | wp-inst/wp-admin/wpmu-options.php | 23 |
4 files changed, 37 insertions, 5 deletions
diff --git a/wp-inst/wp-admin/menu.php b/wp-inst/wp-admin/menu.php index 6dc7b6f..2f0d353 100644 --- a/wp-inst/wp-admin/menu.php +++ b/wp-inst/wp-admin/menu.php @@ -4,12 +4,18 @@ // Menu item name // The minimum level the user needs to access the item: between 0 and 10 // The URL of the item's file + +$menu_perms = get_site_option( "menu_items" ); +if( is_array( $menu_perms ) == false ) + $menu_perms = array(); + $menu[0] = array(__('Dashboard'), 'read', 'index.php'); $menu[5] = array(__('Write'), 'edit_posts', 'post.php'); $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php'); $menu[20] = array(__('Links'), 'manage_links', 'link-manager.php'); $menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php'); -#$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); +if( $menu_perms[ 'plugins' ] == 1 ) + $menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); if ( current_user_can('edit_users') ) $menu[35] = array(__('Users'), 'read', 'profile.php'); else @@ -49,8 +55,6 @@ $submenu['options-personal.php'][10] = array(__('General'), 'manage_options', 'o $submenu['options-personal.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php'); $submenu['options-personal.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php'); -#$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); - $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); if( $wpblog == 'main' && current_user_can( "level_10" ) ) { diff --git a/wp-inst/wp-admin/plugins.php b/wp-inst/wp-admin/plugins.php index 9c56fbb..25dbd30 100644 --- a/wp-inst/wp-admin/plugins.php +++ b/wp-inst/wp-admin/plugins.php @@ -1,7 +1,13 @@ <?php -return; require_once('admin.php'); +$menu_perms = get_site_option( "menu_items" ); +if( is_array( $menu_perms ) == false ) + $menu_perms = array(); + +if( $menu_perms[ 'plugins' ] != 1 ) + return; + if ( isset($_GET['action']) ) { check_admin_referer(); diff --git a/wp-inst/wp-admin/wpmu-edit.php b/wp-inst/wp-admin/wpmu-edit.php index eab0a4f..9d9eef6 100644 --- a/wp-inst/wp-admin/wpmu-edit.php +++ b/wp-inst/wp-admin/wpmu-edit.php @@ -13,6 +13,7 @@ switch( $_GET[ 'action' ] ) { update_site_option( "WPLANG", $_POST[ 'WPLANG' ] ); update_site_option( "illegal_names", split( ' ', $wpdb->escape( $_POST[ 'illegal_names' ] ) ) ); update_site_option( "limited_email_domains", split( ' ', $wpdb->escape( $_POST[ 'limited_email_domains' ] ) ) ); + update_site_option( "menu_items", $_POST[ 'menu_items' ] ); header( "Location: wpmu-options.php?updated=true" ); exit; break; diff --git a/wp-inst/wp-admin/wpmu-options.php b/wp-inst/wp-admin/wpmu-options.php index a2aad1d..d24c19f 100644 --- a/wp-inst/wp-admin/wpmu-options.php +++ b/wp-inst/wp-admin/wpmu-options.php @@ -45,7 +45,7 @@ if (isset($_GET['updated'])) { </table> </fieldset> <fieldset class="options"> - <legend><?php _e('Operational Settings <em>(These settings cannot be modified by blog owners)') ?></legend> + <legend><?php _e('Operational Settings <em>(These settings cannot be modified by blog owners)</em>') ?></legend> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <th scope="row"><?php _e('Banned Names:') ?></th> @@ -61,6 +61,27 @@ if (isset($_GET['updated'])) { </tr> </table> </fieldset> + <fieldset class="options"> + <legend><?php _e('Menus <em>(Enable or disable WP Backend Menus)</em>') ?></legend> + <table cellspacing="2" cellpadding="5" class="editform"> + <tr><th scope='row'>Menu</th><th scope='row'>Enabled</th></tr> + <?php + $menu_perms = get_site_option( "menu_items" ); + $menu_items = array( "plugins" ); + while( list( $key, $val ) = each( $menu_items ) ) + { + if( $menu_perms[ $val ] == '1' ) { + $checked = ' checked'; + } else { + $checked = ''; + } + print "<tr><th scope='row'>" . ucfirst( $val ) . "</th><td><input type='checkbox' name='menu_items[" . $val . "]' value='1'" . $checked . "></tr>"; + } + ?> + </table> + </fieldset> + <fieldset class="options"> + </fieldset> <p class="submit"> <input type="submit" name="Submit" value="<?php _e('Update Options') ?>" /> </p> |
