Jump to content

Make dashboard plugin page the default admin page


kriegar
 Share

Recommended Posts

Something like this will redirect you.

(not tested)

class RedirectToDashboard extends WireData implements Module {

  public static function getModuleInfo() {
    return array(
      'title' => "Redirect To Dashboard",
      'version' => "0.0.1",
      'summary' => "Redirect",
      'autoload' => true,
      'singular' => true,
    );
  }

  public function init() {
    $this->addHookBefore("ProcessHome::execute", $this, "redirectTo");
    $this->addHookBefore("ProcessPagelist::execute", $this, "redirectTo");
  }

  public function redirectTo($event) {
    if (!$this->user->isSuperuser()) {
      $this->wire('session')->redirect('/processwire/setup/dashboard/');
    }
  }
}
Link to comment
Share on other sites

Also, the module itself should handle the redirect:

// Redirect calls for the admin homepage to the dashboard (first child page)
if ($this->page->id == 2) {
    $this->session->redirect($this->page->child->url);
}

i usually just move the dashboard page up to the top if it isn't there after installing.

you could also try posting your issue on the module's topic.

Link to comment
Share on other sites

  • 4 years later...
On 1/18/2016 at 12:28 PM, diogo said:

I made a module for this sometime ago https://github.com/ocorreiododiogo/ProcessHomeAdmin

Should still work.

 The last time I used this module was on Dev 3.0.149 and it worked fine (in conjunction with your AdminCustomPages module).  I've just installed on Dev 3.0.155 and it seems to be having no effect.  Any ideas?

Link to comment
Share on other sites

1 hour ago, applab said:

 The last time I used this module was on Dev 3.0.149 and it worked fine (in conjunction with your AdminCustomPages module).  I've just installed on Dev 3.0.155 and it seems to be having no effect.  Any ideas?

It's working nicely for me on the newest dev version of PW. Did you change the process on the admin page from "ProcessHome" to "ProcessHomeReplace"?

Link to comment
Share on other sites

41 minutes ago, diogo said:

It's working nicely for me on the newest dev version of PW. Did you change the process on the admin page from "ProcessHome" to "ProcessHomeReplace"?

Doh!, you are indeed correct.  How did I miss that in the 2 line readme!

Thanks.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...