WordPress Access Control - Version 4.0.5

Version Description

  • December 17, 2013 =

  • Fix a bug with 3rd level menus or deeper

Download this release

Release Info

Developer brandon.wamboldt
Plugin Icon wp plugin WordPress Access Control
Version 4.0.5
Comparing to
See all releases

Code changes from version 4.0.4 to 4.0.5

Files changed (3) hide show
  1. lib/Walker.php +18 -1
  2. readme.txt +5 -1
  3. wordpress-access-control.php +1 -1
lib/Walker.php CHANGED
@@ -62,7 +62,7 @@ class WpacSecureWalker extends Walker_Nav_Menu
62
  if (WordPressAccessControl::check_conditions($element->object_id) || get_option('wpac_show_in_menus', 'with_access') == 'always') {
63
  $this->original_walker->display_element($element, $children_elements, $max_depth, $depth, $args, $output);
64
  } else {
65
- $children_elements[$element->{$this->db_fields['id']}] = array();
66
  }
67
  }
68
 
@@ -111,4 +111,21 @@ class WpacSecureWalker extends Walker_Nav_Menu
111
  {
112
  return isset($this->original_walker->{$var});
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
62
  if (WordPressAccessControl::check_conditions($element->object_id) || get_option('wpac_show_in_menus', 'with_access') == 'always') {
63
  $this->original_walker->display_element($element, $children_elements, $max_depth, $depth, $args, $output);
64
  } else {
65
+ $this->truncate_children($element->{$this->db_fields['id']}, $children_elements);
66
  }
67
  }
68
 
111
  {
112
  return isset($this->original_walker->{$var});
113
  }
114
+
115
+ /**
116
+ * Recursively remote children of a menu item that has been removed.
117
+ *
118
+ * @param integer $id
119
+ * @param array $children
120
+ */
121
+ protected function truncate_children($id, &$children)
122
+ {
123
+ if (isset($children[$id])) {
124
+ foreach ($children[$id] as $child) {
125
+ $this->truncate_children($child->{$this->db_fields['id']}, $children);
126
+ }
127
+
128
+ $children[$id] = array();
129
+ }
130
+ }
131
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: members, only, plugin, restricted, access, menus, 3.3, wp_nav_menu, nonmembers
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 4.0.4
8
 
9
  Restrict pages, posts, custom post types, menus and widgets to members, nonmembers or specific roles and still add to navigation
10
 
@@ -64,6 +64,10 @@ Yes, this is a new feature in 3.1.3. Use the syntax [members role="administrator
64
 
65
  == Changelog ==
66
 
 
 
 
 
67
  = 4.0.4 - December 15, 2013 =
68
 
69
  * Decrease plugin action priority to run after other plugins (Fixes known bug with "CodeFlavours Floating Menu" plugin)
4
  Tags: members, only, plugin, restricted, access, menus, 3.3, wp_nav_menu, nonmembers
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 4.0.5
8
 
9
  Restrict pages, posts, custom post types, menus and widgets to members, nonmembers or specific roles and still add to navigation
10
 
64
 
65
  == Changelog ==
66
 
67
+ = 4.0.5 - December 17, 2013 =
68
+
69
+ * Fix a bug with 3rd level menus or deeper
70
+
71
  = 4.0.4 - December 15, 2013 =
72
 
73
  * Decrease plugin action priority to run after other plugins (Fixes known bug with "CodeFlavours Floating Menu" plugin)
wordpress-access-control.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
5
  * Author: Brandon Wamboldt
6
  * Author URI: http://brandonwamboldt.ca/
7
- * Version: 4.0.4
8
  * Description: This plugin is a powerful tool which gives you fine grained control over your pages and posts (and custom post types), allowing you to restrict a page, post, or custom post type to members, non-members, or even specific roles. You can customize how these pages and posts show up in search results, where users are directed when they visit them, and much more. <strong>You can even make your entire blog members only!</strong>.
9
  */
10
 
4
  * Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
5
  * Author: Brandon Wamboldt
6
  * Author URI: http://brandonwamboldt.ca/
7
+ * Version: 4.0.5
8
  * Description: This plugin is a powerful tool which gives you fine grained control over your pages and posts (and custom post types), allowing you to restrict a page, post, or custom post type to members, non-members, or even specific roles. You can customize how these pages and posts show up in search results, where users are directed when they visit them, and much more. <strong>You can even make your entire blog members only!</strong>.
9
  */
10