MarkE Posted May 20 Share Posted May 20 For some reason no users other than superusers can see the page tree on a site. The message is "You don't have access to list page /" That seems to imply they don't have access to the home page, but looking at the access to the home page, there are no restrictions. Any ideas? Link to comment Share on other sites More sharing options...
MarkE Posted May 20 Author Share Posted May 20 I'm not sure that there is an obvious answer to this as it seems to be related to a bunch of other inexplicable problems I have been having which are peculiar to my live envronment. See my comments here. Link to comment Share on other sites More sharing options...
virtualgadjo Posted May 22 Share Posted May 22 Hi, just in case but i'm quite sure you've already checked this... have those users this checked in their role(s) ? if yes, i'm as stuck as you are ? have a nice day 1 Link to comment Share on other sites More sharing options...
JimmyPrice Posted June 10 Share Posted June 10 (edited) On 5/21/2024 at 12:21 AM, MarkE said: For some reason no users other than superusers can see the page tree on a site. The message is "You don't have access to list page /" That seems to imply they don't have access to the home page, but looking at the access to the home page, there are no restrictions. Any ideas? Any update? Edited July 12 by JimmyPrice Link to comment Share on other sites More sharing options...
MarkE Posted June 11 Author Share Posted June 11 On 6/10/2024 at 8:32 AM, JimmyPrice said: Any update? The problem is caused by moving all my ready.php into a module ready(), which works in the dev environment, but not in live. See my second post. I'm still working on this one! Link to comment Share on other sites More sharing options...
JimmyPrice Posted June 12 Share Posted June 12 Ok ? Link to comment Share on other sites More sharing options...
MarkE Posted June 14 Author Share Posted June 14 I have now looked into this in more depth and am even more puzzled. In ready.php, I have two hooks: wire()->addHookBefore('ProcessPageList::execute', function(HookEvent $event) { $process = $event->object; $listable = $process->page->listable; bd([$process->page, $listable], 'page, listable'); if(!$listable) bd(debug_backtrace(), 'backtrace not listable'); }); wire()->addHookAfter('Page::listable', function(HookEvent $event) { $event->return = true; bd($event->return, 'listable return'); }); In the dev environment, this always yields the correct result, regardless of whether the hooks are called from /site/ready.php or my module ready(): In the live environment, the result is correct only if the hooks are called from /site/ready.php. If the hooks are called from my module ready(), the result is: Link to comment Share on other sites More sharing options...
BrendonKoz Posted June 14 Share Posted June 14 Does it have the same end result if, on your dev environment, you have debug disabled? (I'm assuming the dev environment has debug enabled in this instance.) Link to comment Share on other sites More sharing options...
MarkE Posted June 14 Author Share Posted June 14 4 hours ago, BrendonKoz said: Does it have the same end result if, on your dev environment, you have debug disabled? Yes - it makes no difference. On the dev site, I can track exactly what happens by stepping through with Xdebug. The only code between the two bardumps is a couple of WireData 'gets' for 'return' returning true. It would be great to be able to do the same in the live environment! 1 Link to comment Share on other sites More sharing options...
BrendonKoz Posted June 15 Share Posted June 15 When I was adjusting the Page's editable, listable, viewable, and addable method hooks, I was testing access for one to determine access to another. This caused a bit of a recursively confusing mess. You aren't by chance doing something similar, are you? If so, different calls of the same method can/will return different values due to context, and data that either is, or hasn't yet been set (typically access to templates in my case). 1 Link to comment Share on other sites More sharing options...
MarkE Posted June 15 Author Share Posted June 15 4 hours ago, BrendonKoz said: You aren't by chance doing something similar, are you? Interesting thought. I have a hook on viewable within a hook on ProcessPageEdit::buildFormContent. I also have a hook after User::hasPagePermission. I tried removing them temporarily and it made no difference. Link to comment Share on other sites More sharing options...
MarkE Posted June 15 Author Share Posted June 15 SOLVED! With many thanks to @BrendonKoz and @flydev for encouraging me to persist in tracking this down. I finally managed to get the error to occur in the dev environment. That was progress as it enabled me to use Xdebug to see what was happening. I found another module with a listable hook in ready(). What was happening was this: When my hook was in /site/ready.php it ran after any hooks in modules' ready(), because that is the order ProcessWire calls them in. When I put my hook in my module's ready() it still ran after the other module's hook in the dev environment but before it in the live environment. Assigning a higher priority to my hook (1000 - i.e. greater than the default 100) fixed it. 1 Link to comment Share on other sites More sharing options...
flydev Posted June 15 Share Posted June 15 1 Link to comment Share on other sites More sharing options...
BrendonKoz Posted June 15 Share Posted June 15 It doesn't break, or negatively affect the other module now, does it? ? You've been struggling with this for awhile - glad you've made significant progress (and maybe completely solved it)! flydev definitely deserves the credit aside from yourself though, imho. ? 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