BuyCourses: Fix redirection after self-registration - refs BT#14835

pull/2715/head
Angel Fernando Quiroz Campos 6 years ago
parent 274eb20eb2
commit cc40f065d7
  1. 6
      main/auth/inscription.php
  2. 12
      plugin/buycourses/src/process.php

@ -1056,7 +1056,11 @@ if ($form->validate()) {
if ($usersCanCreateCourse) {
$form_register->addElement('html', $form_data['button']);
} else {
$form_register->addElement('html', $form_data['go_button']);
if (!empty($redirectBuyCourse)) {
$form_register->addButtonNext(get_lang('Next'));
} else {
$form_register->addElement('html', $form_data['go_button']);
}
}
$text_after_registration .= $form_register->returnForm();

@ -11,11 +11,7 @@ use ChamiloSession as Session;
require_once '../config.php';
$currentUserId = api_get_user_id();
if (empty($currentUserId)) {
Session::write('buy_course_redirect', Security::remove_XSS($_SERVER['REQUEST_URI']));
header('Location: '.api_get_path(WEB_CODE_PATH).'auth/inscription.php');
exit;
}
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(
WEB_PLUGIN_PATH
).'buycourses/resources/css/style.css"/>';
@ -37,6 +33,12 @@ $buyingCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_COURSE
$buyingSession = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_SESSION;
$queryString = 'i='.intval($_REQUEST['i']).'&t='.intval($_REQUEST['t']);
if (empty($currentUserId)) {
Session::write('buy_course_redirect', api_get_self().'?'.$queryString);
header('Location: '.api_get_path(WEB_CODE_PATH).'auth/inscription.php');
exit;
}
if ($buyingCourse) {
$courseInfo = $plugin->getCourseInfo($_REQUEST['i']);
$item = $plugin->getItemByProduct($_REQUEST['i'], BuyCoursesPlugin::PRODUCT_TYPE_COURSE);

Loading…
Cancel
Save