WordPress Access Control - Version 4.0.6

Version Description

  • December 18, 2013 =

  • Fixed a bug with multi-level menus when using page inheritance instead of nav menus

Download this release

Release Info

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

Code changes from version 4.0.5 to 4.0.6

Files changed (3) hide show
  1. lib/Walker.php +15 -7
  2. readme.txt +5 -1
  3. wordpress-access-control.php +1 -1
lib/Walker.php CHANGED
@@ -27,6 +27,11 @@ class WpacSecureWalker extends Walker_Nav_Menu
27
  */
28
  protected $original_walker;
29
 
 
 
 
 
 
30
  /**
31
  * Constructor.
32
  *
@@ -47,9 +52,9 @@ class WpacSecureWalker extends Walker_Nav_Menu
47
  */
48
  public function sync_vars_with_original_walker()
49
  {
50
- $this->original_walker->tree_type = $this->tree_type;
51
- $this->original_walker->db_fields = $this->db_fields;
52
- $this->original_walker->max_pages = $this->max_pages;
53
  }
54
 
55
  /**
@@ -57,10 +62,14 @@ class WpacSecureWalker extends Walker_Nav_Menu
57
  */
58
  public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
59
  {
60
- $this->sync_vars_with_original_walker();
61
-
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
  }
@@ -75,7 +84,6 @@ class WpacSecureWalker extends Walker_Nav_Menu
75
  */
76
  public function __call($method, $arguments)
77
  {
78
- $this->sync_vars_with_original_walker();
79
  return call_user_func_array(array($this->original_walker, $method), $arguments);
80
  }
81
 
27
  */
28
  protected $original_walker;
29
 
30
+ /**
31
+ * @var array
32
+ */
33
+ protected $track_ids = array();
34
+
35
  /**
36
  * Constructor.
37
  *
52
  */
53
  public function sync_vars_with_original_walker()
54
  {
55
+ $this->tree_type = $this->original_walker->tree_type;
56
+ $this->db_fields = $this->original_walker->db_fields;
57
+ $this->max_pages = $this->original_walker->max_pages;
58
  }
59
 
60
  /**
62
  */
63
  public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
64
  {
 
 
65
  if (WordPressAccessControl::check_conditions($element->object_id) || get_option('wpac_show_in_menus', 'with_access') == 'always') {
66
+ // Make sure the page isn't an orphan (e.g. this is a page walker and the
67
+ // element was a child of a members only page that got removed, so we
68
+ // shouldn't show it)
69
+ if (in_array($element->{$this->db_fields['parent']}, $this->track_ids) || $element->{$this->db_fields['parent']} == 0) {
70
+ $this->track_ids[] = $element->{$this->db_fields['id']};
71
+ $this->original_walker->display_element($element, $children_elements, $max_depth, $depth, $args, $output);
72
+ }
73
  } else {
74
  $this->truncate_children($element->{$this->db_fields['id']}, $children_elements);
75
  }
84
  */
85
  public function __call($method, $arguments)
86
  {
 
87
  return call_user_func_array(array($this->original_walker, $method), $arguments);
88
  }
89
 
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.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,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.5 - December 17, 2013 =
68
 
69
  * Fix a bug with 3rd level menus or deeper
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.6
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.6 - December 18, 2013 =
68
+
69
+ * Fixed a bug with multi-level menus when using page inheritance instead of nav menus
70
+
71
  = 4.0.5 - December 17, 2013 =
72
 
73
  * Fix a bug with 3rd level menus or deeper
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.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
 
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.6
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