diff --git a/account_prefs_inc.php b/account_prefs_inc.php index 607469293e..6651d7c31e 100644 --- a/account_prefs_inc.php +++ b/account_prefs_inc.php @@ -92,7 +92,16 @@ function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_ diff --git a/core/html_api.php b/core/html_api.php index 555063d1de..6c13685922 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -544,12 +544,10 @@ function html_login_info() { } echo ''; - + # Project Selector hidden if only one project visisble to user $t_show_project_selector = true; - if( count( current_user_get_accessible_projects() ) == 1 ) { - - // >1 - $t_project_ids = current_user_get_accessible_projects(); + $t_project_ids = current_user_get_accessible_projects(); + if( count( $t_project_ids ) == 1 ) { $t_project_id = (int) $t_project_ids[0]; if( count( current_user_get_accessible_subprojects( $t_project_id ) ) == 0 ) { $t_show_project_selector = false; @@ -579,6 +577,14 @@ function html_login_info() { echo ''; echo '
' . $t_now . '
'; } else { + # User has only one project, set it as both current and default + if( ALL_PROJECTS == helper_get_current_project() ) { + helper_set_current_project( $t_project_id ); + current_user_set_default_project( $t_project_id ); + # Force reload of current page + $t_redirect_url = str_replace( config_get( 'short_path' ), '', $_SERVER['REQUEST_URI'] ); + html_meta_redirect( $t_redirect_url, 0, false ); + } echo '
' . $t_now . '
'; } }