Show Course completion date when manually assign certidficate (Certificate Award date shortcode )

Use this shortcode in case you are assigning certificates manually form course admin.

Please note that this shortcode will be added already in vibe-shortcode pluguin version 1.9.7.

Till then please refer following:

1. Please add the given code in your child theme functions.php or in wp-content/plugins/wplms-customizer/wplms-customizer.php file .

if (!function_exists('vibe_certificate_awarded_date')) {
    function vibe_certificate_awarded_date( $atts, $content = null ) {
            $uid=$_GET['u'];
            $cid=$_GET['c'];
            global $bp,$wpdb;
 
            if(isset($uid) && is_numeric($uid) && isset($cid) && is_numeric($cid) && get_post_type($cid) == 'course'){
            $date = $wpdb->get_var($wpdb->prepare( "
                                SELECT activity.date_recorded
                                FROM {$bp->activity->table_name} AS activity
                                LEFT JOIN {$bp->activity->table_name_meta} as meta ON activity.id = meta.activity_id
                                WHERE   activity.component  = 'course'
                                AND     activity.type   = 'bulk_action'
                                AND     meta.meta_key   = 'add_certificate'
                                AND     meta.meta_value = %d
                                AND     activity.item_id = %d
                                ORDER BY date_recorded DESC LIMIT 0,1
                            " ,$uid,$cid));
 
                if(isset($date)){
                    return date_i18n( get_option( 'date_format' ), strtotime($date));                  
                }
            }  
        return '[certificate_awarded_date]';
    }
    add_shortcode('certificate_awarded_date', 'vibe_certificate_awarded_date');
}

2. Then please use this shortcode in your certificate template :

[certificate_awarded_date]