Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wplms_course_credits','wplms_show_new_course_student_status',9999,2);
- function wplms_show_new_course_student_status($credits,$course_id){
- if(is_user_logged_in() && !is_singular('course')){
- $user_id=get_current_user_id();
- $check=get_user_meta($user_id,$course_id,true);
- if(isset($check) && $check){
- if($check < time()){
- return '<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('EXPIRED %s COURSE','vibe'),'<span class="subs">').'</span></strong></a>';
- }
- $check_course= bp_course_get_user_course_status($user_id,$course_id);
- $new_check_course = get_user_meta($user_id,'course_status'.$course_id,true);
- if(isset($new_check_course) && is_numeric($new_check_course) && $new_check_course){
- switch($check_course){
- case 1:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('START %s COURSE','vibe'),'<span class="subs">').'</span></strong></a>';
- break;
- case 2:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('CONTINUE %s COURSE','vibe'),'<span class="subs">').'</span></strong></a>';
- break;
- case 3:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('UNDER %s EVALUATION','vibe'),'<span class="subs">').'</span></strong></a>';
- break;
- case 4:
- $marks = get_post_meta($course_id,$user_id,true);
- if(isset($marks)){
- $marks = '('.$marks.')';
- }
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('FINISHED %s COURSE','vibe'),'<span class="subs">').'</span></strong></a>'.$marks;
- break;
- default:
- $credits =apply_filters('wplms_course_status_display','<a href="'.get_permalink($course_id).'"><strong>'.sprintf(__('COURSE %s ENABLED','vibe'),'<span class="subs">').'</span></strong></a>',$course_id);
- break;
- }
- }else{
- switch($check_course){
- case 0:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.__('START','vibe').'<span class="subs">'.__('COURSE','vibe').'</span></strong></a>';
- break;
- case 1:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.__('CONTINUE','vibe').'<span class="subs">'.__('COURSE','vibe').'</span></strong></a>';
- break;
- case 2:
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.__('UNDER','vibe').'<span class="subs">'.__('EVALUATION','vibe').'</span></strong></a>';
- break;
- default:
- $marks = get_post_meta($course_id,$user_id,true);
- if(isset($marks)){
- $marks = '('.$marks.')';
- }
- $credits ='<a href="'.get_permalink($course_id).'"><strong>'.__('FINISHED','vibe').'<span class="subs">'.__('COURSE','vibe').'</span></strong></a>'.$marks;
- break;
- }
- }
- }
- }
- return $credits;
- }
Add Comment
Please, Sign In to add comment