Pete Posted March 9, 2014 Share Posted March 9, 2014 This module creates a blank dashboard page in your site admin and sets it as default when you login instead of the page list. It came from a need in a few projects where I was creating modules for various user roles to use and I didn't want them to see the page list at all, but needed to display various stats and quick access buttons. For example, if you have a person who is creating invoices or doing other back-office stuff in various other Process modules then as an admin you wouldn't want them to access the page tree anyway, and there are other scenarios where you might want to have a dashboard instead of launching straight into the page list. It also requires (and adds) a permission - "dashboard" - so you can create new roles and assign the dashboard permission to those roles - something you might want to do fairly commonly if you have a lot of admin modules that you want to restrict access to. Editing the template is simple - there is a dashboard.php template file in the /site/modules/ProcessDashboard/ folder (decided to leave it in there to keep it safe, but I might be tempted to move it into /site/templates/ ) as well as .js and .css files ready to add your code to. You can use the API as you usually would to create your dashboard experience. For example, display data based on user roles or even specific users using code like this: if ($user->hasRole('invoices') { echo "Hi staff member $user->name. View invoices to be processed below: ... ..."; } if ($user->name == 'pete') { // Show some super-awesome stuff here } You can also do away with the dashboard.php template file and edit the module directly, putting your code and output in the execute() function (the way most Process modules are written) but I decided to include the separate template file to make it easier for more people to use. This does touch on areas a few other modules have addressed to some degree (like diogo's Custom Admin Pages) but this is designed for one purpose - instant dashboard creation. You can download the module here: http://modules.processwire.com/modules/process-dashboard/ This module also uses code from diogo's ProcessHomeAdmin module so that the default admin page can be overridden. 20 Link to comment Share on other sites More sharing options...
Pete Posted March 9, 2014 Author Share Posted March 9, 2014 It's worth mentioning that whilst I've made it easy for newcomers to modules to create a dashboard template, it is worth learning how Process modules work so that you can create your own to do some amazing stuff in the ProcessWire admin. See the ProcessHello module as a starting point: https://github.com/ryancramerdesign/ProcessHello EDIT: There was also another way to do this module - I could have skipped creating a separate dashboard page under the admin page and simply made the admin page load the dashboard, however I quite like having the link in the menu at the top of the page so it's really obvious how to get back there. 3 Link to comment Share on other sites More sharing options...
pwired Posted March 9, 2014 Share Posted March 9, 2014 This is very usable because there is a need to give clients a non destructive access to the back end. Link to comment Share on other sites More sharing options...
Pete Posted March 11, 2014 Author Share Posted March 11, 2014 I forgot modules take a little while to become approved in the directory - you should be able to download and test this module out now. 1 Link to comment Share on other sites More sharing options...
joer80 Posted January 19, 2015 Share Posted January 19, 2015 I installed this and it seems a non admin user with dashboard permissions can see the dashboard or page list, but they can not click on the processwire logo to go back to the admin home / dashboard link. It does a redirect loop. They can only click the tabs on the right. They also can not click admin in the breadcrumb trail on the page list to get back to the dashboard. Do you know how to fix this? Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 21, 2015 Share Posted January 21, 2015 @joer80 I think the purpose of this module is exactly to avoid certain users to access to the standard PW admin, it's not an issue. Link to comment Share on other sites More sharing options...
joer80 Posted January 21, 2015 Share Posted January 21, 2015 What this module does, is make the new dashboard page the new home for the admin section, instead of the page list, so shouldnt the process wire logo and breadcrum also go to this new home since that is where the login script takes all users after they login? Link to comment Share on other sites More sharing options...
Pete Posted January 25, 2015 Author Share Posted January 25, 2015 On my installation clicking the PW logo or Admin link from the breadcrumb does take me to the dashboard as expected. I can't remember, but I think at first install it appeared to the right of Pages in the menu - I think (trying to remember) it needs to be the first child page under /processwire/ in the tree in order to work like this. Link to comment Share on other sites More sharing options...
joer80 Posted January 25, 2015 Share Posted January 25, 2015 Yeah, it installed it as being not the first and I did have to move it, but it still seems to only work if you use the tabs. Not sure why I am not the same as yours. I am running the default admin even. Link to comment Share on other sites More sharing options...
regesh Posted November 2, 2015 Share Posted November 2, 2015 After installing module on 2.6.20 dev only superuser can login without getting blank page or error. (( And applying rules makes nothing. Please help! Link to comment Share on other sites More sharing options...
robig Posted December 8, 2015 Share Posted December 8, 2015 Hi! I'm using your Dashboard module. I want to make the bookmarks accessible there. I'v already played with some of the admin helper functions like so: $admin = $this->wire('pages')->get($config->adminRootPageID); function printNav(Page $pa) { echo "<ul>"; foreach($pa->children("check_access=0") as $p) { if(!$p->viewable()) continue; $title = $p->title; if(strlen($title)) { //$icon = $this->getPageIcon($p); echo "<li>"; echo "<a class='has-items has-ajax-items' data-from='topnav-page-$p' data-json='{$p->url}navJSON/' " . "href='$p->url'>$title</a>"; if($p->numChildren) printNav($p); echo "</li>"; } } echo "</ul>"; } echo printNav($admin); It's already displaying the Navbar. But I dont know how the ajax stuff works. Also Ajax isnt required here. So I hope, you can give me a hint how to solve this. Thank you robig Link to comment Share on other sites More sharing options...
Macrura Posted January 19, 2016 Share Posted January 19, 2016 @Pete - i'm wondering how to 'addon' to this module in the sense that your module provides a blank canvas for setting up a dashboard, but i'd like to avoid changing anything in your module and also avoid putting anything custom into the module folder; what i did to hack this was change the dashboard module like this: public function execute() { // Redirect calls for the admin homepage to the dashboard (first child page) if ($this->page->id == 2) { $this->session->redirect($this->page->child->url); } $dashboard = $this->getDashboard(); return $dashboard->render(); } public function ___getDashboard() { $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); return $t; } then in my dashboard widgets module, i have this: public function init() { $this->addHookAfter('ProcessDashboard::getDashboard', $this, 'getCustomDashboard'); } public function getCustomDashboard(HookEvent $event) { $template = $event->return; $event->replace = true; $template = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); $event->return = $template; } let me know what you think, if this would be a possible change that wouldn't affect existing sites, but would allow other modules to hook into the main dashboard for rendering... 1 Link to comment Share on other sites More sharing options...
adrianmak Posted January 19, 2016 Share Posted January 19, 2016 I extracted in pw 2.7.2. However pw is not recognized a new module is available Link to comment Share on other sites More sharing options...
joer80 Posted February 24, 2016 Share Posted February 24, 2016 Is there any way to make the tab look active/open in the header when you are on the dashboard? Link to comment Share on other sites More sharing options...
KarlvonKarton Posted September 6, 2016 Share Posted September 6, 2016 @Pete In PW 3.0.33 the users with permission 'dashboard' are not redirected to the dashboard after log in. In my case I got stuck with a white screen (url /processwire/dashboard/ was working) EDIT: This code did the trick for me (for now): if ($this->page->id == 2) { // Before // $this->session->redirect($this->page->child->url); // NOW $this->session->redirect($this->pages->get(1028)->url); } Link to comment Share on other sites More sharing options...
Macrura Posted January 19, 2017 Share Posted January 19, 2017 @KarlvonKarton so the issue you are having is that the child page is access restricted and that's why you get the blank screen; to solve this you just need to add a selector to the child api call like so: if ($this->page->id == 2) { $childPage = $this->page->child('check_access=0'); $this->session->redirect($childPage->url); } then you don't have to hardcode the ID of the dashboard page into the module... Somehow this may have worked as it was originally in earlier versions of PW, but i encountered the same issue as you and had to make that change. 2 Link to comment Share on other sites More sharing options...
dragan Posted November 18, 2017 Share Posted November 18, 2017 Thanks for this module! I had to change a few things to get this to work with PW 3.0.84 a) add PW namespace b) change page id from 2 to 3 (2 = admin root, but 3 = page, which is the actual default landing page after login) if ($this->page->id === 3) { (and then the two lines from @Macrura above) c) // $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); // this creates a URL like site/modules\ProcessWire/ProcessDashboard/ $t = new TemplateFile($this->config->paths->siteModules . "ProcessDashboard/dashboard.php"); Perhaps you could re-check, and publish a new version that officially supports PW 3 ? 1 Link to comment Share on other sites More sharing options...
neosin Posted March 23, 2018 Share Posted March 23, 2018 On 11/18/2017 at 12:53 PM, dragan said: Thanks for this module! I had to change a few things to get this to work with PW 3.0.84 a) add PW namespace b) change page id from 2 to 3 (2 = admin root, but 3 = page, which is the actual default landing page after login) if ($this->page->id === 3) { (and then the two lines from @Macrura above) c) // $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); // this creates a URL like site/modules\ProcessWire/ProcessDashboard/ $t = new TemplateFile($this->config->paths->siteModules . "ProcessDashboard/dashboard.php"); Perhaps you could re-check, and publish a new version that officially supports PW 3 ? @dragan thanks for this, it solved my issues with the module Link to comment Share on other sites More sharing options...
neosin Posted March 26, 2018 Share Posted March 26, 2018 My dashboard child pages are not showing in breadcrumbs, how can I get them to display ? for example, I added a page in admin under dashboard and when I navigate to it in the cms I can see it fine but the breadcrumb still shows "home > dashboard" instead of "home > dashboard > My Page". 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