I’ve got an issue that I’m not sure of the best way to solve. I’m going to be creating a wordpress CMS site that will have some public pages and some members-only pages. There will also be "board-members-only" pages as well.
I would like to allow the client to be able to create new pages and have them dynamically show up in the menu but only show the menu options for the members-only pages if the member is logged on. I thought about using the wp_list_pages exclude_tree option to exclude the member pages and then write some code to list them if the user is logged on but apparently exclude_tree does not work at the moment.
I found a hack on wpengineer.com/adding-a-private-page-into-the-navigation but this explicitly adds in a private page (using the page id) if the user can read private pages. This wouldn’t work for dynamically adding pages.
Can anyone suggest a good way of having pages dynamically added to the menu for member-only pages? Should I use private pages or shortcodes that restrict the content to members?
I’d appreciate any help! I really don’t want to have to learn drupal for this. :-(
I still don’t see how just checking if you’re logged in though is a complete solution since there will be some options in the menu that are public (for everyone) and some that are for members-only. How would you get this to work by simply checking if you’re logged in? I don’t want to have to hardcode page ids since the goal is for the user to be able to add pages and have them show up dynamically.
I could write code where I check if logged in and if not, then exclude the member-only pages using the "exclude_tree" arg for wp_list_pages, but this apparently does not work for 2.8.
Another option is writing a wp_list_pages filter hook where I check a custom field that indicates if the page is member-only. This is a variation of the technique described on //blog.nullvariable.com/2009/09/ea … wordpress/.
Sorry to be dense but am I missing something obvious?
At this point, I’m tempted to use concrete5 since it has everything I need right out of the box without hacking. It is so easy to theme and even easier for the end user.
Your main menu should use the "include" argument to only have the pages you want in it. (this will leave all other pages excluded).
Put all of those private pages under one section.
If user is logged in, display another wp_list_pages for the private section only.