diff --git a/main/auth/inscription.php b/main/auth/inscription.php index f06a54e96f..4f970fda47 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -719,6 +719,11 @@ if ($form->validate()) { } } + if (!empty($_SESSION['urlReturn'])) { + $form_data['action'] = api_get_path(WEB_PATH).$_SESSION['urlReturn']; + Session::erase('urlReturn'); + } + $form_data = CourseManager::redirectToCourse($form_data); $form_register = new FormValidator('form_register', 'post', $form_data['action']); diff --git a/plugin/buycourses/src/process.php b/plugin/buycourses/src/process.php index 8ce7ecc439..622146a492 100644 --- a/plugin/buycourses/src/process.php +++ b/plugin/buycourses/src/process.php @@ -8,10 +8,12 @@ * Initialization */ require_once '../config.php'; +use ChamiloSession as Session; $currentUserId = api_get_user_id(); if (empty($currentUserId)) { + Session::write('urlReturn', Security :: remove_XSS($_SERVER['REQUEST_URI'])); header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/inscription.php'); exit; } diff --git a/plugin/buycourses/view/catalog.tpl b/plugin/buycourses/view/catalog.tpl index e6f0d6f939..0bf21f2edb 100644 --- a/plugin/buycourses/view/catalog.tpl +++ b/plugin/buycourses/view/catalog.tpl @@ -42,10 +42,10 @@ {% elseif course.enrolled == "NO" %}
- + {{ 'SeeDescription'|get_plugin_lang('BuyCoursesPlugin') }} - + {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
@@ -92,7 +92,7 @@ {% elseif session.enrolled == "NO" %}
- + {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}