Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Certificate plugin: Fix bug for certificates with learnpath index as content type #5610

Open
wants to merge 2 commits into
base: 1.11.x
Choose a base branch
from

Conversation

juancp-contidosdixitais

The certificate generation for certificates with learnpath index as content type is actually broken.

If we use this option, the custom certificates plugin code will attempt to instantiate a new LearnpathList object by passing a course code instead of a course_info array.

$courseCode = api_get_course_id();

if (empty($courseCode)) {
$courseCode = isset($_REQUEST['course_code']) ? Database::escape_string($_REQUEST['course_code']) : '';
$courseInfo = api_get_course_info($courseCode);
if (!empty($courseInfo)) {
$courseId = $courseInfo['real_id'];
}
} else {
$courseInfo = api_get_course_info($courseCode);
}

$list = new LearnpathList(
$studentId,
$courseCode,
$sessionId,
null,
false,
$categoryId
);

* @param array $courseInfo Optional course code (otherwise we use api_get_course_id())

public function __construct(
$user_id,
$courseInfo = [],
$session_id = 0,
$order_by = null,
$check_publication_dates = false,
$categoryId = null,
$ignoreCategoryFilter = false,
$ignoreLpVisibility = false,
bool $includeSubscribedLp = true
) {
if (empty($courseInfo)) {
$courseInfo = api_get_course_info();
}

This PR fixes the issue by instantiating a new LearnpathList with the correct parameters. Additionally, the description of the LearnpathList constructor for the $courseInfo parameter has been corrected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants