Not WORKING Enable Course Duration from Start Course for 3.9.9 and v4

Home Forums Legacy Support Support queries Setup issues Not WORKING Enable Course Duration from Start Course for 3.9.9 and v4

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #374076
    kenetork
    Participant
    This reply has been marked as private.
    #374078
    kenetork
    Participant
    This reply has been marked as private.
    #374103
    kenetork
    Participant
    Could you please help me with thi to finally have this all done? Wiating for the code to copy and paste, please. Thanks!
    #374158
    Anshuman Sahu
    Keymaster
    here 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);
    #374177
    kenetork
    Participant
    Will 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? thanks
    #374272
    Anshuman Sahu
    Keymaster
    Well 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 :
    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);
    you have to add this code at the end of your wplms-customizer.php file .
    #374304
    kenetork
    Participant
    This reply has been marked as private.
    #374367
    Anshuman Sahu
    Keymaster
    Hi 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);
    #374376
    kenetork
    Participant
    Alex 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. Thanks
    #374440
    kenetork
    Participant
    I 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!
    #374655
    Anshuman Sahu
    Keymaster
    I double tested the code and its working for me ,please check if the settings is enabled and student did not start the course .
    #374949
    kenetork
    Participant
    Ok,thanks! you can close this tpic, if anything I will ask you later, thanks!
    #375008
    Veronica
    Moderator
    ok closed
Viewing 13 posts - 16 through 28 (of 28 total)
  • The topic ‘Not WORKING Enable Course Duration from Start Course for 3.9.9 and v4’ is closed to new replies.