I’ve been extremely busy as of late, but I managed to find some time to update my WordPress Access Control plugin to version 4!
With version 4, I’ve rewritten the Walker class that I use to remove pages from the menu if a user doesn’t have access to them. Before, I implemented a custom Walker based on the Walker_Nav_Menu class. This worked OK for themes that used the default walker, but broke if the theme had a custom walker. The #1 source of bugs was related to theme incompatibilities because of this issue.
My new approach is a Walker class that extends Walker_Nav_Menu, but takes the original walker as a constructor argument. I override only the display_element function, to remove menu items the user doesn’t have access to, then I call the original walker’s display_element function and let it handle the rest. Of course, this approach would break any themes that override the walk or display_element functions for some reason, but it’s a lot better than my previous approach.
I’m currently on version 4.0.8, as I’ve had a number of small bugs with my new approach, but it seems to be pretty solid now.
Interestingly, my plugin now has 59,000 downloads (+16,000 from the original), for a total of 75,000 downloads. I was pretty excited to see that, as I released this plugin thinking I was the only one who’d ever use it (I released it as a portfolio piece).