Version Description
- Adds filter to role capabilities (for adding items to customized admin menus with custom capabilities).
Download this release
Release Info
Developer | kylephillips |
Plugin | Nested Pages |
Version | 3.1.2 |
Comparing to | |
See all releases |
Code changes from version 3.1.1 to 3.1.2
app/Entities/AdminCustomization/AdminMenuItems.php
CHANGED
@@ -298,10 +298,10 @@ class AdminMenuItems extends AdminCustomizationBase
|
|
298 |
|
299 |
// Set each role's menu order
|
300 |
$user_roles = $this->user_repo->allRoles([]);
|
|
|
301 |
foreach( $user_roles as $role ){
|
302 |
|
303 |
-
$role_capabilities = $this->user_repo->
|
304 |
-
$role_capabilities = $role_capabilities['capabilities'];
|
305 |
|
306 |
foreach ( $np_menu_original as $menu_item ){
|
307 |
|
298 |
|
299 |
// Set each role's menu order
|
300 |
$user_roles = $this->user_repo->allRoles([]);
|
301 |
+
|
302 |
foreach( $user_roles as $role ){
|
303 |
|
304 |
+
$role_capabilities = $this->user_repo->getSingleRoleCapabilities($role['name']);
|
|
|
305 |
|
306 |
foreach ( $np_menu_original as $menu_item ){
|
307 |
|
app/Entities/AdminMenu/AdminSubmenu.php
CHANGED
@@ -44,7 +44,7 @@ class AdminSubmenu
|
|
44 |
if ($key == $this->post_type_repo->editSlug($this->post_type)){
|
45 |
// Add the "All Link"
|
46 |
$submenu[$this->slug][50] = [$sub[5][0], 'edit_pages', esc_url(admin_url('admin.php?page=' . $this->slug))];
|
47 |
-
unset($sub[
|
48 |
$menu_items = $sub;
|
49 |
}
|
50 |
}
|
44 |
if ($key == $this->post_type_repo->editSlug($this->post_type)){
|
45 |
// Add the "All Link"
|
46 |
$submenu[$this->slug][50] = [$sub[5][0], 'edit_pages', esc_url(admin_url('admin.php?page=' . $this->slug))];
|
47 |
+
if ( isset($sub[5]) ) unset($sub[5]); // Remove Top Level
|
48 |
$menu_items = $sub;
|
49 |
}
|
50 |
}
|
app/Entities/User/UserRepository.php
CHANGED
@@ -72,6 +72,20 @@ class UserRepository
|
|
72 |
return false;
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* Can current user sort pages
|
77 |
* @return boolean
|
72 |
return false;
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Get the capabilities for a role
|
77 |
+
*/
|
78 |
+
public function getSingleRoleCapabilities($role = 'administrator')
|
79 |
+
{
|
80 |
+
global $wp_roles;
|
81 |
+
if ( isset($wp_roles->roles[$role]) ) :
|
82 |
+
$capabilities = $wp_roles->roles[$role]['capabilities'];
|
83 |
+
if ( $role == 'administrator' && class_exists('GFCommon') ) $capabilities['gform_full_access'] = true;
|
84 |
+
return apply_filters('nestedpages_capabilities', $capabilities, $role);
|
85 |
+
endif;
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
/**
|
90 |
* Can current user sort pages
|
91 |
* @return boolean
|
app/NestedPages.php
CHANGED
@@ -12,7 +12,7 @@ class NestedPages
|
|
12 |
$np_env = 'live';
|
13 |
|
14 |
global $np_version;
|
15 |
-
$np_version = '3.1.
|
16 |
|
17 |
if ( is_admin() ) $app = new NestedPages\Bootstrap;
|
18 |
if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
|
12 |
$np_env = 'live';
|
13 |
|
14 |
global $np_version;
|
15 |
+
$np_version = '3.1.2';
|
16 |
|
17 |
if ( is_admin() ) $app = new NestedPages\Bootstrap;
|
18 |
if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
|
app/Views/settings/partials/nav-menu-settings.php
CHANGED
@@ -6,8 +6,7 @@ $c = 1;
|
|
6 |
foreach ( $this->admin_menu_settings->roles as $role ) :
|
7 |
$menu = $this->admin_menu_settings->np_menu_original;
|
8 |
$menu = ( isset($menu[$role['name']]) ) ? $menu[$role['name']] : $menu['default'];
|
9 |
-
$role_capabilities = $this->user_repo->
|
10 |
-
$role_capabilities = $role_capabilities['capabilities'];
|
11 |
$hidden = $this->settings->adminMenuHidden($role['name']);
|
12 |
if ( !$hidden ) $hidden = [];
|
13 |
?>
|
6 |
foreach ( $this->admin_menu_settings->roles as $role ) :
|
7 |
$menu = $this->admin_menu_settings->np_menu_original;
|
8 |
$menu = ( isset($menu[$role['name']]) ) ? $menu[$role['name']] : $menu['default'];
|
9 |
+
$role_capabilities = $this->user_repo->getSingleRoleCapabilities($role['name']);
|
|
|
10 |
$hidden = $this->settings->adminMenuHidden($role['name']);
|
11 |
if ( !$hidden ) $hidden = [];
|
12 |
?>
|
nestedpages.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Nested Pages
|
4 |
Plugin URI: http://nestedpages.com
|
5 |
Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
|
6 |
-
Version: 3.1.
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
3 |
Plugin Name: Nested Pages
|
4 |
Plugin URI: http://nestedpages.com
|
5 |
Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
|
6 |
+
Version: 3.1.2
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
|
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 3.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -105,6 +105,9 @@ No. The menu synchronization currently only works within the pages post type.
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
108 |
= 3.1.1 =
|
109 |
* Removes ability to hide Settings and Nested Pages menus from administrators within the admin customization interface (removing items hides links to necessary admin sections).
|
110 |
* Adds ability to reset admin menu settings by clicking a single button
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 3.1.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 3.1.2 =
|
109 |
+
* Adds filter to role capabilities (for adding items to customized admin menus with custom capabilities).
|
110 |
+
|
111 |
= 3.1.1 =
|
112 |
* Removes ability to hide Settings and Nested Pages menus from administrators within the admin customization interface (removing items hides links to necessary admin sections).
|
113 |
* Adds ability to reset admin menu settings by clicking a single button
|