Plugin for menu restriction by role

Is there a plugin that works well with hivepress/jobhive when it comes to restricting menu visibility by user role?

1 Like

Hi,
Yes, please try this one - Nav Menu Roles – WordPress plugin | WordPress.org

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hello - I need to log into every page to stay logged in. Otherwise, each time I choose a menu item, I am logged out and have to log in again. When I deactivate WP Code Snippits, then the problem goes away. Here is my code snippit - I only want logged in uses to see the vendors and listings. It works, but then I get this weird behavior of logging out and in every time I click a menue item (logged in on ‘experts’ but not on ‘listings’, etc:

add_action('wp_footer', 'hide_results_for_logged_out_users');

function hide_results_for_logged_out_users() {
    if ( !is_user_logged_in() ) { 
        echo '
        <style>
        /* Hide search result details for vendors (experts) */
        .hp-vendors,
        .hp-vendor__header,
        .hp-vendor__content,
        .hp-vendor__footer {
          display: none !important; /* Hide all vendor (expert) details */
        }

        /* Hide service listings */
        .hp-listings,
        .hp-listing__header,
        .hp-listing__content,
        .hp-listing__footer,
        .hp-listing__attributes,
        .hp-listing__details {
          display: none !important; /* Hide all service listing details */
        }

        /* Display a friendly message asking users to create an account */
        .hp-page__content::before {
          content: "Please create a FREE account to view the full search results.";
          display: block;
          font-size: 1.5em;
          color: #555;
          text-align: center;
          margin: 20px 0;
        }
        </style>
        ';
    }
}

Just getting a bit more information I need to be able to display that there are search results but I don’t want to show what the search results are and currently this snippet does that but the abnormality of logging in and out when I switch between web pages from the menu occurs.

Hi,

Please check the solution in this topic.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.