Home › Forums › Legacy Support › Support queries › Setup issues › Not WORKING Enable Course Duration from Start Course for 3.9.9 and v4
- This topic has 27 replies, 3 voices, and was last updated 3 years ago by Veronica.
-
AuthorPosts
-
November 3, 2021 at 3:59 pm #374076kenetorkParticipantThis reply has been marked as private.November 3, 2021 at 4:09 pm #374078kenetorkParticipantThis reply has been marked as private.November 5, 2021 at 4:07 pm #374103kenetorkParticipantCould you please help me with thi to finally have this all done? Wiating for the code to copy and paste, please. Thanks!November 6, 2021 at 1:47 pm #374158Anshuman SahuKeymasterhere is the full customizer file you should overwrite with my code :
<?php /* Plugin Name: WPLMS Customizer Plugin Plugin URI: http://www.Vibethemes.com Description: A simple WordPress plugin to modify WPLMS template Version: 1.0 Author: VibeThemes Author URI: http://www.vibethemes.com License: GPL2 */ /* Copyright 2014 VibeThemes (email : [email protected]) wplms_customizer program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. wplms_customizer program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with wplms_customizer program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ include_once 'classes/customizer_class.php'; if(class_exists('WPLMS_Customizer_Plugin_Class')) { // instantiate the plugin class $wplms_customizer = new WPLMS_Customizer_Plugin_Class(); } add_filter('wplms_course_sub_nav',function($settings){ foreach ($settings as $key => $ss) { if(in_array($ss['slug'], array(BP_COURSE_STATS_SLUG,'quiz_results','assignment_results','notes_reviews' ))){ unset($settings[$key]); } } return $settings; }); add_filter('vibebp_component_icon',function($icon,$compoent){ if($compoent == 'course'){ // Check component id , set $icon as svg $icon = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-monitor"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>'; } return $icon; },99999,2); //add add_filter('wplms_get_student_mmy_course_tabs',function($tabs){ unset($tabs['announcementsnews']); unset($tabs['qna']); unset($tabs['notes']); return $tabs; }); add_filter('wplms_course_nav_menu','wplms_remove_course_menu',999999999,1); function wplms_remove_course_menu($defaults){ unset($defaults['news']); return $defaults; } add_action('wplms_course_details_widget',function($details,$id){ if(!class_exists('WPLMS_tips')){ return $details; } $tips = WPLMS_tips::init(); if(isset($tips) && isset($tips->settings) && !empty($tips->settings['calculate_course_duration_from_start_course'])){ $status = bp_course_get_user_course_status(get_current_user_id(),$id); if(!empty($status) && $status > 2){ unset($details['time']); } } return $details; },999999999,2);
November 6, 2021 at 3:24 pm #374177kenetorkParticipantWill this work for both version? I can see this is for v4 only, please consider v3.9.9 has a different wplms customizer codes inside the file, I mean, I need to add you code into v3.9.9 but the code will be override and I could crash something, could you please let me know about that as well plese? thanksNovember 8, 2021 at 12:27 pm #374272Anshuman SahuKeymasterWell the code will work for both if you are using old course layouts not the elementor one in v4 . the actual code which will remove the time is this :
you have to add this code at the end of your wplms-customizer.php file .add_action('wplms_course_details_widget',function($details,$id){ if(!class_exists('WPLMS_tips')){ return $details; } $tips = WPLMS_tips::init(); if(isset($tips) && isset($tips->settings) && !empty($tips->settings['calculate_course_duration_from_start_course'])){ $status = bp_course_get_user_course_status(get_current_user_id(),$id); if(!empty($status) && $status > 2){ unset($details['time']); } } return $details; },999999999,2);
November 8, 2021 at 4:52 pm #374304kenetorkParticipantThis reply has been marked as private.November 9, 2021 at 1:41 pm #374367Anshuman SahuKeymasterHi there is a little mistake in our code this is the correct code :add_action('wplms_course_details_widget',function($details,$id){ if(!class_exists('WPLMS_tips')){ return $details; } $tips = WPLMS_tips::init(); if(isset($tips) && isset($tips->settings) && !empty($tips->settings['calculate_course_duration_from_start_course'])){ $status = bp_course_get_user_course_status(get_current_user_id(),$id); if(!empty($status) && $status <= 1){ unset($details['time']); } } return $details; },999999999,2);
November 9, 2021 at 4:21 pm #374376kenetorkParticipantAlex I edited the code but I am still seeing the time, could you please test this on your side with a test user to I see it working please? test it on both versions 3.9.9 and v4. I need to be sure this is working properly. ThanksNovember 10, 2021 at 6:20 pm #374440kenetorkParticipantI still can see the time, could you please check this out alex and show me how its working for you? Maybe a video from your side to check this out? thanks See: https://prnt.sc/1z1ul7q thanks!November 15, 2021 at 1:51 pm #374655Anshuman SahuKeymasterI double tested the code and its working for me ,please check if the settings is enabled and student did not start the course .November 22, 2021 at 5:58 pm #374949kenetorkParticipantOk,thanks! you can close this tpic, if anything I will ask you later, thanks!November 23, 2021 at 10:48 am #375008VeronicaModeratorok closed -
AuthorPosts
- The topic ‘Not WORKING Enable Course Duration from Start Course for 3.9.9 and v4’ is closed to new replies.