Timeline for Display navigation menu item conditionally based on user capabilities
Current License: CC BY-SA 2.5
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:37 | history | edited | CommunityBot |
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
|
|
May 20, 2011 at 12:42 | comment | added | Tom Auger | Thanks for the clarification. Absolutely a custom taxonomy or custom field would be the proper way to go. Another option that I've come up with is based on the template. I don't like my solution as much because you shouldn't couple a template to built-in functionality like that, but there's a logical connection between the template (which ought to check whether the user has access to see the content) and the menu. I'm going to post my code in an answer, below, for other users with the same question. | |
May 17, 2011 at 15:56 | comment | added | fuxia♦ | @TomAuger Add appropriate meta data to the linked post object, for example a custom taxonomy or a post meta field. Check the field’s value in the walker. | |
May 17, 2011 at 15:54 | comment | added | Tom Auger | So the walker is good for making sure that a menu item that is flagged as "protected" doesn't appear. But how do you create a menu item that is flagged as "protected", or, better yet, as belonging to a specific role or capability? Sounds like we're extending menu items and adding some more user-configurable parameters to the menu item form...? | |
Apr 21, 2011 at 19:43 | comment | added | Tom Auger | Absolutely brilliant. Thanks for this - though I'm surprised it's quite as complex as all that. Like you said, possibly an oversight? | |
Apr 21, 2011 at 19:42 | vote | accept | Tom Auger | ||
Apr 7, 2011 at 14:24 | history | answered | fuxia♦ | CC BY-SA 2.5 |