Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Course page total unit duration
- This topic has 7 replies, 3 voices, and was last updated 7 years, 5 months ago by Skywalker [ ex VibeThemes].
Viewing 8 posts - 1 through 8 (of 8 total)
-
AuthorPosts
-
November 16, 2016 at 8:04 am #80110ulysseswSpectatorPlease 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.November 17, 2016 at 2:43 pm #80439Skywalker [ ex VibeThemes]ParticipantVia frontend fo to edit course page ->settings->course duration parameter->choose hours and save. http://prntscr.com/d8gp3mNovember 17, 2016 at 7:55 pm #80495ulysseswSpectatorHi 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.November 18, 2016 at 3:06 pm #80690H.K. LatiyanParticipantFirst 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.November 18, 2016 at 9:06 pm #80744ulysseswSpectatorHi 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.November 19, 2016 at 8:51 am #80807H.K. LatiyanParticipantYou can use round function to round of minutes, refer: http://prntscr.com/d95y8qNovember 19, 2016 at 6:04 pm #80909ulysseswSpectatorHow to auto convert if its more than an hour? For e.g. 230 minutes, l like to show it as 3 Hours 50 Minutes.November 21, 2016 at 11:36 am #81037Skywalker [ ex VibeThemes]ParticipantSorry 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.
-
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
- The topic ‘Course page total unit duration’ is closed to new replies.