Skip to content

Commit

Permalink
Fix 'enable snippets menu for site admins' multisite setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sheabunge committed Jan 2, 2014
1 parent 4f33785 commit 3b1e1fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Use Sass (libsass) instead of Compass
* Unminify CodeMirror scripts
* Fixes for the WP 3.8 interface
* Fix 'enable snippets menu for site admins' multisite setting

## 1.9
* Add and remove network capabilities as super admins are added and removed
Expand Down
8 changes: 5 additions & 3 deletions code-snippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,15 @@ public function user_can( $deprecated = '' ) {
public function get_cap( $deprecated = '' ) {

if ( is_multisite() ) {
$active_menus = get_site_option( 'menu_items', array() );
$menu_perms = get_site_option( 'menu_items', array() );

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

}
}

return $this->cap;
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ That's fantastic! Join me on [GitHub](https://github.com/bungeshea/code-snippets
* Use Sass (libsass) instead of Compass
* Unminify CodeMirror scripts
* Fixes for the WP 3.8 interface
* Fix 'enable snippets menu for site admins' multisite setting

= 1.9 =
* Add and remove network capabilities as super admins are added and removed
Expand Down

0 comments on commit 3b1e1fb

Please sign in to comment.