Course page total unit duration

Home Forums Legacy Support Support queries How-to & Troubleshooting Course page total unit duration

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #80110
    ulyssesw
    Spectator
    Please see screenshot. http://prnt.sc/d7vzg0 The total unit duration is 2 days 12 hours. In the unit setting, its set as 3600 minutes. This is an offline course. 1 day is 10 hours of training, so 6 days is 60 hours (3600 minutes). But now the way its shown, people gets the idea its a 2.5 days training. How can i show it as only hours and minutes, and not in days. Thanks.
    #80439
    Via frontend fo to edit course page ->settings->course duration parameter->choose hours and save. http://prntscr.com/d8gp3m
    #80495
    ulyssesw
    Spectator
    Hi Skywalker, Im attaching the course info screenshot here: http://prnt.sc/d8kumc In your above solution to change the course duration parameter to hours, it will means changing, in my screenshot, the course duration from 6 Days to 6 Hours. This is not the thing im trying to change. What im referring to is the Unit Duration. In my screenshot, you see 2 Days, 6 Hours. This is the total unit duration. When i set the units, everything is is minutes, and total of 3240 minutes. But when it shows, it is in days and hours. So if you are a visitor, you will be seeing the course info, and wondering, is this a 6 days course or 2 days 6 hours course?? In summary, my question is: We set the unit duration in minutes, how to make it show in minutes too? Thanks.
    #80690
    H.K. Latiyan
    Participant
    First remove the code that you used for showing the unit time in the course details section. After that add the bellow code: add_filter('wplms_course_details_widget','wplms_show_unit_count_and_time'); function wplms_show_unit_count_and_time($course_details){     $course_id = get_the_ID();     $units=bp_course_get_curriculum_units($course_id);     $course_details['units'] = '<li><i class="icon-grid-alt"></i>'.count($units).' Units</li>';     $duration = $total_duration = 0;     foreach($units as $unit){         $duration = get_post_meta($unit,'vibe_duration',true);         if(get_post_type($unit)=='unit'){            $unit_duration_parameter = apply_filters('vibe_unit_duration_parameter',60,$unit);         }elseif(get_post_type($unit)=='quiz'){            $unit_duration_parameter = apply_filters('vibe_quiz_duration_parameter',60,$unit);         }                  $total_duration =  $total_duration + $duration*$unit_duration_parameter;      }                   $course_details['units_duration'] = '<li><i class="icon-clock-1"></i>'. ($total_duration/60).' Minutes </li>';      return $course_details; }   This will show the total unit time in minutes.
    #80744
    ulyssesw
    Spectator
    Hi we are very close to the solution. - I don't need the decimal point. Now its showing e.g. 89.22 minutes. I just need 89 or 90 minutes. - Less than an hour, it can be in minutes only e.g. 45 minutes. - More than an hour, it has to show in hours and minutes e.g. 5 hours 23 minutes. How can we amend the code? Thanks.
    #80807
    H.K. Latiyan
    Participant
    You can use round function to round of minutes, refer: http://prntscr.com/d95y8q  
    #80909
    ulyssesw
    Spectator
    How to auto convert if its more than an hour? For e.g. 230 minutes, l like to show it as 3 Hours 50 Minutes.
    #81037
    Sorry this will not be possible to just restrict the timing in hours and minutes, it can b set to just minutes or just hours, or you can use the first code provided by HK which will convert the time automatically to hours and minutes. But if the total time is more than 1 day then it will show the timing in days.  
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Course page total unit duration’ is closed to new replies.