Jump to content

Hide page tree in the admin


renobird
 Share

Recommended Posts

I am looking for a way to add a full pagetree to select the path to redirect users to. It would enable us to redirect to FE pages too , and possibly to the profile page....

Does anybody know how to replace the standard selector whith a full pagetree to select a page in that  module ?

 

Link to comment
Share on other sites

  • 1 year later...

Hi all,

As I want to make full use of all the features build standard in the Admin, I'm currently creating a custom dashboard for user so they can add and edit pages. These user may only acces their own created pages and of course add new once using 1 restricted template. For this I use Admin Restrict Page Tree module. 

This is working as expected, page tree and page tab is not visible. But I found a bug which I cant seem to solve:

As said the user has the ability to add a page. On this add page, the breadcrumbs are shown. If a user would click, it will open the page tree on /admin/page/list/. This should also be not visible, but it still is. I cant seem to restrict this page.

Same goes also for the admin/page/add/ (showing all the parent page, while the user should only be to see the one page I offer him to edit.) - this one is more difficult and I could except if this was not possible. 

Any pointers would help!

Link to comment
Share on other sites

20 hours ago, monchu said:

To hide breadcrumb, I used this hook in ready.php


$this->addHookBefore('Process::breadcrumb', function(HookEvent $event) {
	$Process = $event->object;
	$Process->wire('breadcrumbs')->removeAll();
});

 

Thanks! So this works for all pages except: /your-admin/page/add/ . Somehow this page is using a different "breadcrumb". Any ideas? @monchu @adrian

Link to comment
Share on other sites

Hey @DL7, just a quick heads-up: I've merged your questions into the support thread for the Admin Restrict Page Tree. The modules/plugins area of the forum is intended for module-specific support threads (one per module), and you can find the correct thread via the modules directory.

Link to comment
Share on other sites

@teppo  Thanks! I only cant find that thread. Via the module page, this board is linked. Could you let me know where to find the correct board?

I did some investigation and found out that the AdminUIkit uses a different way (or at least code) to populate the breadcrumb. For that reason the standard way to remove them doesn't work. To be able to manipulate the output, I used a hook. 

 

$this->addHookAfter('AdminThemeUikit::renderBreadcrumbs', function(HookEvent $event) {
  // Get the object the event occurred on, if needed
  $AdminThemeUikit = $event->object;
  // Populate back return value, if you have modified it
  $event->return = $return;
});

 

Link to comment
Share on other sites

4 hours ago, DL7 said:

@teppo  Thanks! I only cant find that thread. Via the module page, this board is linked. Could you let me know where to find the correct board?

I merged your question to the correct thread earlier, so yes – this is it ?

Link to comment
Share on other sites

  • 4 years later...

Hey there,

I had the same need (hide page tree for certain roles). Used https://processwire.com/modules/admin-restrict-page-tree/ module. Worked like a charm, except that I had the same problem than @DL7, i.e. the bread crumbs provide links to the page tree. The page tree is not displayed, but a page saying "Login" with an "Edit profile" button is shown. That may be a bit confusing for users.

So I add a few lines to the module, in order to optionnaly skip the bredcrumbs rendering (a hook, and a checkbox to choose whether you want to display the page tree for restricted users). It works well with AdminThemeUikit (I didn’t test it with the default admin theme).

I thought this might be useful to other users. @Wanze, @netcarver if you want to have a look at it, maybe for module update? It would be my first contribution to a PW module... ?

  • Like 3
Link to comment
Share on other sites

Very old indeed, but still useful... and still working ?
Who said plugins needed to be updated every week ? Oups... wrong forum... ?

I’ll open an issue on Github.

  • Like 2
  • Thanks 1
  • Haha 1
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...