Support » Plugin: Nav Menu Roles » If menu-item is hidden, restrict access the page

  • Hello,

    I read that it isn’t possible to restrict access to the page, but this is actually what I want to achieve.
    Is it possible to check on the page itself whether its menu-item is hidden? This way, as a workaround, I would be able to throw an error and actually restrict the page from the users which don’t have access to it.

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author helgatheviking


    This plugin only deals with restricting visibility of menu items… and has nothing to do with restricting the page items themselves. It would be very difficult to determine if a page’s menu item was hidden and to restrict visibility of the page accordingly.

    It might be possible, but it is something I can’t provide support for. I would suggest just matching your page visibility settings (via other plugins that handle that) to your menu role settings.

    The other plugins can’t deal with logged in and logged out menu items but most of all with only user roles. This one would be great but it doesn’t restrict users which I need.
    Then I need to look for another plugin…
    How is the data saved? Because I couldn’t find anything in my database.

    Plugin Author helgatheviking


    You can custom code your own solution to logged in/out. The function is_user_logged_in() is easy enough to apply.

    I’m sorry, but my plugin only does 1 thing and tries to do that 1 thing correctly. It would get out of hand if I tried to add a lot more functionality.

    My plugin’s data is save as post meta for the menu items, so it should be in the post_meta table.

    I see it in the postmeta table and it looks like this:

    meta_id: 86
    post_id: 7
    meta_key: _nav_menu_role
    meta_value: a:2:{i:0;s:6:"editor";i:1;s:10:"subscriber";}

    Do these ever change?
    Because then I can check whether the post_id with meta_key = _nav_menu_role exists in the database with the value and restrict access for users?
    Would this work?

    Plugin Author helgatheviking


    This is way beyond the level of support I provide for this plugin, but I can tell you that a page and a page’s menu item do not have the same post ID as far as I know.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘If menu-item is hidden, restrict access the page’ is closed to new replies.