I looked all over the Learndash documentation but I'm unable to find a function to obtain the course title from a course id. Does anyone know how to do this or have some sample code ?
Logged in users can see the certificates they've earned so that they can click the link and download any certificate. Below is the code I currently have. I get the list of currently enrolled courses into $arr1
array. This is an array of Course IDs
. I'm going through this array and for any course that is completed
, I'm allowing user a link to download the course.
Currently, I can get the course download link using function learndash_get_course_certificate_link
. However, I want to display the name of the course (course title) in the text of the a href.
The text DOWNLOAD YOUR PROJECT MANAGEMENT CERTIFICATE
, DOWNLOAD YOUR ACCOUNTING CERTIFICATE
, etc is what I want to display for each certificate.
$current_user = wp_get_current_user();
$arr1 = learndash_get_user_course_access_list($current_user->ID );
foreach ($arr1 as $value)
{
$val = learndash_course_status($value);
if ($val == "Completed")
{
$certificate_link = learndash_get_course_certificate_link($value);
echo '<a href="'.$certificate_link.'">DOWNLOAD YOUR PROJECT MANAGEMENT CERTIFICATE</a>';
echo '<br>';
}
}