Basic Certificates - adding more details from course

After completing my courses, my students need to use a certificate as proof of completion to get professional Continuing Education Units (CEUs) each year. Each course gives them a different number of CEUs and I need to be able to include this on their certificate.

I could use the course category to store the CEUs for each course, but don't see a way to output that to the certificate.

Is there a code for course category for output? Are there other codes that can be added to the Basic Certificate in Settings, apart from: FIRST_NAME, LAST_NAME, COURSE_NAME, COMPLETION_DATE, CERTIFICATE_NUMBER, UNIT_LIST?

thanks,

  • Jose

    Hello there @Wendy,

    Many thanks for your patience :slight_smile:

    I developed some customizations that will allow you to achieve what you want.
    In the attached .zip file you will find two files:
    1- class.basic.certificate.php: This is a change in the core of the plugin. It will be included in the next release. Until then, you will need to replace the existent file in the folder ../wp-content/plugins/coursepress/includes/classes/.
    2- coursepress_certificate_fields.php: This is a must-use plugin that will hook into the certificate fields list and extend it to add the Course Category field. You should place this file in the folder ../wp-content/mu-plugins/ (create the folder if it doesn't exists).

    Now, you will be able to use the macro field COURSE_CATEGORY, which will be replaced with the corresponding category for the course. Keep in mind that a course can belong to many categories. In that case, it will print a coma separated list.

    Just for future reference, this is the code of the mu-plugin:

    if( !class_exists('CoursePress_Certificate_Fields')):
    
        class CoursePress_Certificate_Fields{
    
            function __construct(){
                add_filter( 'coursepress_certificate_fields', array( $this, 'add_custom_fields' ), 20, 3 );
            }
    
            function add_custom_fields( $fields, $student, $course ){
    
                $course_categories = array();
                foreach( get_the_terms( $course->id, 'course_category' ) as $key => $term ){
                    $course_categories[] = $term->name;
                }
                $fields['course_category'] = implode(', ', $course_categories);
                return $fields;
            }
        }
    
        new CoursePress_Certificate_Fields;
    
    endif;

    Please let me know if everything works as expected.

    Cheers,
    José