I don’t know if this is the right or best way, but here’s how I handled it. The goal was for users who login in with a researcher account to see a friendly welcome page rather than the admin dashboard.
public function filterAdminDashboardStats($stats)
$this->getRedirect()->gotoUrl(WEB_ROOT . '/welcome');
protected function getRedirect()
protected function userIsResearcher()
$user = current_user();
return $user->role == 'researcher';
This is how it works. The ‘admin_dashboard_stats’ filter is called early-on during processing of the dashboard page (admin/themes/default/index.php). I put the filterAdminDashboardStats function in a plugin. When called, the function aborts execution of the dashboard page by redirecting to a welcome page.
While effective, the solution does not seem very elegant. I’m wondering if there is a better approach.