Skip to content

Commit

Permalink
Redirect index to url for logged in users see BT#14457
Browse files Browse the repository at this point in the history
$_configuration['redirect_index_to_url_for_logged_users'] = 'user_portal.php';
  • Loading branch information
jmontoyaa committed Jun 18, 2018
1 parent 2cba428 commit 0f25790
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.php
Expand Up @@ -101,6 +101,15 @@
// Only if login form was not sent because if the form is sent the user was already on the page.
Event::open();
}

if (!api_is_anonymous()) {
$url = api_get_configuration_value('redirect_index_to_url_for_logged_users');
if (!empty($url)) {
header("Location: $url");
exit;
}
}

if (api_get_setting('display_categories_on_homepage') === 'true') {
$controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
}
Expand Down
4 changes: 4 additions & 0 deletions main/install/configuration.dist.php
Expand Up @@ -901,6 +901,10 @@
// Round score in exercise category export
//$_configuration['exercise_category_round_score_in_export'] = false;

// Redirect index to url for logged in users
// In this example the index.php will be redirected to user_portal.php for logged in users
//$_configuration['redirect_index_to_url_for_logged_users'] = 'user_portal.php';

// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email
Expand Down

2 comments on commit 0f25790

@ywarnier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already exists in the Chamilo configuration parameters, I think, it's called: page_after_login

@jmontoyaa
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not the same. This always redirects the index to the user_portal.php for logged in users, not only after login.

Please sign in to comment.