I want to control access to pages (and menus) based on whether the viewer has a value in a user meta data field.
I've made a plugin that securely receives viewers from another private system where they are signed in, makes an account for them if needed, copies in custom values (about a dozen values) to user meta data, and signs them into the WordPress site. Most will be subscribers, but some could be assigned roles like editor or admin. I can alter this single sign-on system to do something else as needed, but adding the user meta data would be a part of it.
The challenge now:
I want to be able to restrict page access based on one of the user meta data fields. I should be able to block page access by simply checking the user meta data, but what's the best way to remove pages from the menu based on that? Do the menus in most themes have a hook that would allow my plugin to remove a menu item?
The other challenge is adding to the page editor so that admins/editors can specify that the page they are editing can or cannot be seen according to the user meta data.
This seems to be so simple and basic, but I can't find any plugin that controls page/menu access based on user meta data.
Any tips would be appreciated.