owzim Posted February 4, 2016 Share Posted February 4, 2016 Hi, I have a Process module, with a permission 'my-permission'. The user 'user1' has role 'editor' which then has 'my-permission'. The process page under admin is still only showing up for the superuser. Anything else I missed? On 2.7.2. Thanks. Link to comment Share on other sites More sharing options...
kongondo Posted February 4, 2016 Share Posted February 4, 2016 Ha...I had the exact same question . A process module I am working on is not appearing in the menu, even when I remove a permissions requirement. It works practically the same as my ProcessBlog module, the only difference being that Blog shows up in the Admin menu for users with role 'blog' but in the case of this other module, similar to your case, the module doesn't show up in the Admin menu! Link to comment Share on other sites More sharing options...
owzim Posted February 4, 2016 Author Share Posted February 4, 2016 Same here, the Blog module's process page shows up, like you described ... Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 5, 2016 Share Posted February 5, 2016 Just to double check: You used "permission" and not "permissions", which would install/remove a permission automatically. Link to comment Share on other sites More sharing options...
kongondo Posted February 5, 2016 Share Posted February 5, 2016 In my case there are no typos. If I change the parent of the process module to be 'setup', it shows up under setup menu. If I change its parent back to 'admin', it doesn't appear. Totally confounded by this one. I've cleared cache and all... Link to comment Share on other sites More sharing options...
owzim Posted February 5, 2016 Author Share Posted February 5, 2016 Interesting, if I uninstall an reinstall the ProcessBlog module it won't show up either any more. So something fishy is going on while installing? Link to comment Share on other sites More sharing options...
kongondo Posted February 6, 2016 Share Posted February 6, 2016 Got to the bottom of this (I think). Let's say I have a module called ProcessMyModule that has a page called myModulePage that uses the template admin and has the parent admin. That module will display just fine in the admin menu and be visible to users with the permission attached to ProcessMyModule If I add a child page to the page myModulePage, say, myModulePageChild, that uses a template abc, my ProcessMyModule will disappear from the admin menu. The only way to get it back is to (i) enable 'view and edit access' in the template 'abc' [the Access Tab], and (ii) ensure that 'abc' has a template file. So, in my case, the reasons why my ProcessModule was not visible in the admin menu is because its admin page has child pages and those child pages had a template without a template file + without 'view-edit' access enabled.The same thing happens with ProcessMenuBuilder since its admin page has child pages. In the case of ProcessBlog though, its page has no child pages, hence works fine. Link to comment Share on other sites More sharing options...
owzim Posted February 7, 2016 Author Share Posted February 7, 2016 Thanks @kongondo that helped. There were child pages without template files. I added those. But I had to reinstall the process module to show up again as an admin page. I think this is very unintuitive and odd behavior isn't it? Should the be an issue on GitHub? Link to comment Share on other sites More sharing options...
kongondo Posted February 7, 2016 Share Posted February 7, 2016 I had to hit the 'refresh' button a couple of times for changes to show up (rather than uninstalling ) 1 Link to comment Share on other sites More sharing options...
owzim Posted February 7, 2016 Author Share Posted February 7, 2016 I see. Still. I stumbled upon this issue many times in other contexts. Pages did not show up, where not viewable or something similar, because some other page in some relation to it had no template file. In processwire we often use pages if not more for data storage and not to be an actual frontend page, so there should be a and additional flag the the page class or something which helps with that. Link to comment Share on other sites More sharing options...
kongondo Posted February 7, 2016 Share Posted February 7, 2016 I also don't get the 'template file' is needed bit. I couldn't find where that behaviour is defined. If possible, I would want that not to be necessary. Link to comment Share on other sites More sharing options...
BitPoet Posted February 7, 2016 Share Posted February 7, 2016 There's this part in AdminThemeDefaultHelpers.php that I'd call a likely suspect for the missing template file issue. public function renderTopNavItem(Page $p, $level = 0) { $isSuperuser = $this->wire('user')->isSuperuser(); $showItem = $isSuperuser; $children = $p->numChildren && !$level ? $p->children("check_access=0") : array(); $numChildren = count($children); $out = ''; if(!$showItem) { $checkPages = $numChildren ? $children : array($p); foreach($checkPages as $child) { if($child->viewable()) { $showItem = true; break; } } } if(!$showItem) return ''; No clue if this is by design or if viewable is simply the wrong check at this point. I guess the correct thing would be to check the current page's permission (through the module info's permission field if present like it does further down when genererating child page entries), and the loop above was meant to hide items without children from the top navigation (I'm not deep enough into these parts of PW to judge if that is needed). 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