Lance O. Posted February 22, 2017 Share Posted February 22, 2017 I've created a Page field that uses a custom hook (included in /site/read.php) that lists all users with a role of client. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'client') { $event->return = $event->pages->find('template=user,roles=client'); } }); When I log in as the superuser, the list of users displays correctly. However, when I log in using an admin role that I created, the list is empty. I've given full permissions to the "admin" role. Why can't the admin role see the list of users? The ultimate goal is to create a user with a client role, then assign the user to a specific page in the site using the Page field. Link to comment Share on other sites More sharing options...
adrian Posted February 22, 2017 Share Posted February 22, 2017 Try $users instead - that should work with non-superusers. $event->users->find('roles=client'); 4 Link to comment Share on other sites More sharing options...
Lance O. Posted February 23, 2017 Author Share Posted February 23, 2017 That did the trick. Thank you! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now