Skip to content

Commit 3b1e1fb

Browse files
committed
Fix 'enable snippets menu for site admins' multisite setting
1 parent 4f33785 commit 3b1e1fb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Use Sass (libsass) instead of Compass
66
* Unminify CodeMirror scripts
77
* Fixes for the WP 3.8 interface
8+
* Fix 'enable snippets menu for site admins' multisite setting
89

910
## 1.9
1011
* Add and remove network capabilities as super admins are added and removed

code-snippets.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,13 +672,15 @@ public function user_can( $deprecated = '' ) {
672672
public function get_cap( $deprecated = '' ) {
673673

674674
if ( is_multisite() ) {
675-
$active_menus = get_site_option( 'menu_items', array() );
675+
$menu_perms = get_site_option( 'menu_items', array() );
676676

677677
/* If multisite is enabled and the snippet menu is not activated,
678678
restrict snippet operations to super admins only */
679-
if ( ! in_array( 'snippets', $active_menus ) )
679+
if ( ! empty( $menu_perms['snippets'] ) ) {
680+
return $this->cap;
681+
} else {
680682
return $this->network_cap;
681-
683+
}
682684
}
683685

684686
return $this->cap;

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ That's fantastic! Join me on [GitHub](https://github.com/bungeshea/code-snippets
125125
* Use Sass (libsass) instead of Compass
126126
* Unminify CodeMirror scripts
127127
* Fixes for the WP 3.8 interface
128+
* Fix 'enable snippets menu for site admins' multisite setting
128129

129130
= 1.9 =
130131
* Add and remove network capabilities as super admins are added and removed

0 commit comments

Comments
 (0)