Jump to content
shogun

Hide specific pages for specific users in the admin

Recommended Posts

I would like a user to login to the admin and only see certain pages. I cannot figure this out or if it's possible. I've hunted through the forums and nothing seems to be able to do this.

I have a list of pages like this:

Home>
Page 1 >
Page 2 >

I would like User 1 to login and only see:

Home> 
Page 1 >

And User 2 to login and only see:

Home>
Page 2 >

 

 

Share this post


Link to post
Share on other sites

I usually hide some pages because the user has no business snooping around them.

Put in ready.php:

if(!$this->user->hasRole('superuser')){

  /* hide pages on their ID:
  1026  FormBuilder
  1000  Search
  */
  $wire->addHookAfter('Page(id=1026|1000)::listable', function($event) {
    $event->return = false;
  });
}

You have ro refine the condition fo the user though...

In case you have more users or have to do this dynamically you are better off with permissions or a module to do this.

  • Like 1

Share this post


Link to post
Share on other sites

 

5 minutes ago, psy said:

@shogun

This module may help or provide a good starting point:

https://modules.processwire.com/modules/admin-restrict-page-tree/

 

I don't want to hide the entire tree. I want to restrict a user to view and edit only a specific tree like this:

User 2: So they can only see/edit the page 2 tree below for example and not page 1

Home >

Page 1>

Page 2 >

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...