WordPress.org

Forums

Namaste! LMS
Certificates (3 posts)

  1. gmwestrup
    Member
    Posted 1 year ago #

    Is there a way to list or display all earned certificates in a page rather than in the wp-admin dashboard?

    https://wordpress.org/plugins/namaste-lms/

  2. prasunsen
    Member
    Plugin Author

    Posted 1 year ago #

    Not yet, we'll have to add shortcode for this.

  3. Anshu Verma
    Member
    Posted 1 year ago #

    @Prasunsen thanks for such awesome plugin

    @gmwestrup: if you are still looking for a workaround I have made the following changes to shortcodes.php in controllers folder:

    function mynamastecertificates() {
       	global $wpdb, $user_ID;
    
       	if(!is_user_logged_in()) return "";
       		$_cert = new NamasteLMSCertificateModel();
    		$certificates = $_cert -> student_certificates($user_ID);
    		$student_id = $user_ID;
       		ob_start();
       		require(NAMASTE_PATH."/views/my-certificates.php");
       		if(!sizeof($certificates)) _e('No Completed certificates.', 'namaste');
       		$content = ob_get_contents();
       		ob_end_clean();
       		return $content;
       }
       add_shortcode( 'mynamastecertificates', 'mynamastecertificates' );

    and I just use [mynamastecertificates] shortcode anywhere on the page or post and it shows the user certificates. :)

    You will have to make some changes to my-certificates.php in view folder as well.

    In line 12 I have changed

    <tr><td><a href="admin.php?page=namaste_view_certificate&id=<?php echo $certificate->id?>&student_id=<?php echo $student_id?>&noheader=1" target="_blank"><?php echo $certificate->title?></a></td>

    to

    <tr><td><a href="<?php echo get_option('siteurl'); ?>/wp-admin/admin.php?page=namaste_view_certificate&id=<?php echo $certificate->id?>&student_id=<?php echo $student_id?>&noheader=1" target="_blank"><?php echo $certificate->title?></a></td>

    Hope it helps :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Namaste! LMS
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.