Jump to content
MichaMichaMicha

Only show certain roles in User List

Recommended Posts

I've a site with different sections. Each user is assigned to a section and each section has an editor.

I want those editors to be able to modify the users that are assigned to their section.

I tried hooking into ProcessUser::execute but I'm not sure how to filter the 'pages'.

$this->addHookBefore('ProcessUser::execute', $this, 'modifyuserpagelist'); 

In what way am I able to modify the User List?

Edited by MichaMichaMicha

Share this post


Link to post
Share on other sites

You want to hook into this method:

	public function ___executeList() {
		return $this->renderList("limit=25, status<" . Page::statusMax);
	}

It's defined in the superclass, ProcessPageType.

As the renderList method itself is not hookable, you'd need to generate your own markup which is returned from executeList()

  • Like 1

Share this post


Link to post
Share on other sites

You want to hook into this method:

	public function ___executeList() {
		return $this->renderList("limit=25, status<" . Page::statusMax);
	}

It's defined in the superclass, ProcessPageType.

As the renderList method itself is not hookable, you'd need to generate your own markup which is returned from executeList()

Great, that worked. Thanks!

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.

  • Similar Content

    • By humanafterall
      Hi,
      I would like to set an admin template to 'https only' as recommended in the Processwire security docs.
      However if I do this it forces this setting locally too, resulting in https://localhost requests which result in an error page.
      Is there a simple way round this? Setting https for templates in the config?
      Thanks!
    • By VeiJari
      Hello,
      I'm trying to create a page via api and populate values to it. I can populate everything except user pages to a page reference array.
      Code: 
      $dataUsers = $data->project->users; foreach($dataUsers as $dataUser) { $newProject->projectUsers->add(wire()->pages->find('template=user, id=' . $dataUser->id)); } I'm receiving my data via JSON.
      Is there something I'm missing?
      Thanks for help
    • By DanielKit
      Hi. I'm currently stuck at the login page in my project. Once I enter my admin username and my password and press login, nothing happens. The page just reloads. However, the URL changes from http://myipaddress/processwire to http://myipaddress/processwire/?login=1. I've checked all of my server settings, and to my knowledge, all seems to be fine there. I don't know where to go from here.. Thanks in advance!
    • By VeiJari
      Hi, this is the first we are trying to make a page that has only one type of user that has access to every page. 
      The other users should only have a given access to specific pages, not to the whole template.
      My structure
      -Field -Organisation -Project -Report I want that the "measurer" role only has access to "project x" and it's children, but no view access to every project, organisation or field. I've tried to do this with https://modules.processwire.com/modules/page-edit-per-user/ but it still needs a view access to the whole tree to see the "project x" page. Or is there something I haven't figured out?
      Maybe I have to make it via the API: a select field in the "organisation" template where the admins could add the users and then I use hook to update the privileges?
      Have you done something like this and how did you accomplish it?
      Any help would be appreciated.
       
    • By modifiedcontent
      Small annoyance: I get a horizontal scrollbar in UIkit admin area - or actually Admin Theme Boss based on Uikit 3. I tried to fix it with CSS, but had trouble isolating/targeting it and don't want to mess with module or core files. I think this issue has been reported before. Is there a recommended fix? 
×
×
  • Create New...