1 dashboard.module | dashboard_user_login(&$edit, $account) |
Implements hook_user_login().
File
- core/
modules/ dashboard/ dashboard.module, line 176 - Provides an administrative dashboard.
Code
function dashboard_user_login(&$edit, $account) {
// Don't redirect if a destination is already set.
if (!empty($_GET['destination'])) {
return;
}
// Don't redirect if during installation.
if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install') {
return;
}
// Don't redirect for password reset forms.
if (isset($_POST['form_id']) && $_POST['form_id'] == 'user_pass_reset') {
return;
}
// Don't redirect if no permission to access dashboard.
if (!user_access('access dashboard', $account)) {
return;
}
// Don't redirect if redirect setting is not set.
if (config_get('dashboard.settings', 'dashboard_login_redirect') != 1) {
return;
}
// Check access to any dashboard layouts, and redirect.
$router_item = menu_get_item('admin/dashboard');
$dashboard_layouts = layout_load_multiple_by_router_item($router_item);
foreach ($dashboard_layouts as $dashboard_layout) {
if (!$dashboard_layout->disabled && $dashboard_layout->checkAccess()) {
$_GET['destination'] = 'admin/dashboard';
break;
}
}
}