unset "continue course" and "course finished"

Home Forums Legacy Support Support queries How-to & Troubleshooting unset "continue course" and "course finished"

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #5573
    trapaniettech
    Spectator
    hi, i need to allow a users to get a free course. But this free course is accessible to a users with the same credential, wich i sent trought email (newsletter); the problem is : - when the users get the login (more than one) remain in memory the data that has saved the other users. This is normal. it's possible for a particular course o membership to unset the function "continue course" and "course finished" ? So all users with the same login can do the course without saved data to the other users. Thanks
    #5629
    trapaniettech
    Spectator
    i create this code and whit this i can disable the string "mark this unit complete" and related process; but obviously all process is blocked. what i insert in code to enable only the string "next unit" and pass the unit ? (for other course i need to lock the unit so the settings in course manager is enabled) add_filter('wplms_course_finished','check_if_the_user_is_free',10,5); add_filter('wplms_unit_mark_complete','check_if_the_user_is_free',10,5); function check_if_the_user_is_free($flag,$course_id,$user_id){ $membership_ids != 4; //4 is the id of free membership level if(function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel($membership_ids,$user_id)) { return 1; // Continue with process }else{ return 0; // Disable the process } return $flag; }
    #5858
    Anshuman Sahu
    Keymaster
    You can try this : https://wplms.io/support/knowledge-base/reset-course-on-finish/ In this user have to finish the course  .For the continue course you can apply the same reset function for the user when he/she logs out or when other user opens the single course page  .
    #5859
    trapaniettech
    Spectator
    hi, it's possible to set media lock based for membership ? it's this the code ? how i set the membership ? // added in version 1.5.3 , Assignment -> Unit Locking : Mark Assignments complete before seeing the mark this unit complete switch add_filter('wplms_unit_mark_complete','wplms_assignments_force_unit_complete',1,3); function wplms_assignments_force_unit_complete($mark_unit_html,$unit_id,$course_id){ $flag=0; $assignment_locking = vibe_get_option('assignment_locking'); if(isset($assignment_locking) && $assignment_locking){ $unit_assignments = get_post_meta($unit_id,'vibe_assignment',false); if(is_Array($unit_assignments) && is_array($unit_assignments[0])) $unit_assignments = vibe_sanitize($unit_assignments); if(isset($unit_assignments) && is_array($unit_assignments)) foreach($unit_assignments as $unit_assignment){ if(is_numeric($unit_assignment)){ $user_id = 4; $assignment_complete = get_post_meta($unit_assignment,$user_id,true); if(isset($assignment_complete) && $assignment_complete){ $flag=0; }else{ $flag=1; } }//end-if }//end-for } if($flag) return ''.__('FINISH ASSIGNMENT TO MARK UNIT COMPLETE','vibe').''; return $mark_unit_html; } can you help me ? thanks
    #5867
    trapaniettech
    Spectator
    i'm try with your function and i see the message "Course Reset for User" and the course is effettively reset. but in course remain the string : "finished course" : http://prnt.sc/8wo1tt how in this case replace with "start course" ? thanks
    #5869
    trapaniettech
    Spectator
    see that image
    #5874
    trapaniettech
    Spectator
    for me is not good because this happen with all courses ... hi, it's possible to set media lock based for membership ?
    #5987
    trapaniettech
    Spectator
    i don't understand what do you mean. the function that you provide just reset course he/she logs out or when other user opens the single course page ? this is correct ? add_filter('wplms_course_finished','check_if_the_user_is_free',10,5); add_filter('wplms_unit_mark_complete','check_if_the_user_is_free',10,5); function check_if_the_user_is_free($flag,$course_id,$user_id){ $membership_ids != 4; //4 is the id of free membership level if(function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel($membership_ids,$user_id)) { return 1; // Continue with process }else{ //return 0; // Disable the process course_reset_on_finish($course_id,$marks,$user_id); // call the function for course reset } return $flag; }
    #6001
    Marinazel
    Participant
    Hi, I found that the WPLMS has build-in translations to Spanich, French, Italian and so on languages. The files are located in theme/languages   under *.po and *.mo files. I've downloaded Poedit and created a language version for my required language. Then I've uploaded the *.po and *.mo files to the language folder. How can I switch/activate the user language of the required language on one special site? I'm not talking about admin language, this one already switched to the required language but the the users language of the WPLMS. I use MP Multisite. All other sites will remain on English. But this particular site should be on specific language. Thanks in advance,  
    #6003
    trapaniettech
    Spectator
    i insert the code : https://wplms.io/support/knowledge-base/reset-course-on-finish/ in wp-content/plugins/wplms-customizer/wplms-customizer.php but the course is not reset. Appear the string "Course Reset for User" but the course remain "finished"
    #6168
    Anshuman Sahu
    Keymaster
    YEs it would remain finished if you want that course should get reset completely then please  try this code  : add_action('wplms_evaluate_course','course_reset_on_finish',999,3); function course_reset_on_finish($course_id,$marks,$user_id){ $status = bp_course_get_user_course_status($user_id,$course_id);   if(isset($status) && is_numeric($status)){ // Necessary for continue course bp_course_update_user_course_status($user_id,$course_id,0);   $course_curriculum=vibe_sanitize(get_post_meta($course_id,'vibe_course_curriculum',false)); update_user_meta($user_id,'progress'.$course_id,0); foreach($course_curriculum as $c){ if(is_numeric($c)){ delete_user_meta($user_id,$c); delete_post_meta($c,$user_id); if(get_post_type($c) == 'quiz'){ $questions = vibe_sanitize(get_post_meta($c,'quiz_questions'.$user_id,false));   if(!isset($questions) || !is_array($questions)) // Fallback for Older versions $questions = vibe_sanitize(get_post_meta($c,'vibe_quiz_questions',false)); else delete_post_meta($c,'quiz_questions'.$user_id); // Re-capture new questions in quiz begining if(isset($questions) && is_array($questions) && is_Array($questions['ques'])) foreach($questions['ques'] as $question){ global $wpdb; if(isset($question) && $question !='' && is_numeric($question)) $wpdb->query($wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='trash' WHERE comment_post_ID=%d AND user_id=%d",$question,$user_id)); } } } } /*=== Fix in 1.5 : Reset Badges and CErtificates on Course Reset === */ $user_badges=vibe_sanitize(get_user_meta($user_id,'badges',false)); $user_certifications=vibe_sanitize(get_user_meta($user_id,'certificates',false)); if(isset($user_badges) && is_Array($user_badges) && in_array($course_id,$user_badges)){ $key=array_search($course_id,$user_badges); unset($user_badges[$key]); $user_badges = array_values($user_badges); update_user_meta($user_id,'badges',$user_badges); } if(isset($user_certifications) && is_Array($user_certifications) && in_array($course_id,$user_certifications)){ $key=array_search($course_id,$user_certifications); unset($user_certifications[$key]); $user_certifications = array_values($user_certifications); update_user_meta($user_id,'certificates',$user_certifications); } /*==== End Fix ======*/ echo '<p>'.__('Course Reset for User','vibe').'</p>';   do_action('wplms_course_reset',$course_id,$user_id); }   }
    #6169
    Anshuman Sahu
    Keymaster
    Hi Marinazel, Please create a new topic in the translation issues .
    #6190
    trapaniettech
    Spectator
    thanks i try. how i do to apply the same reset function for the user when he/she logs out or when other user opens the single course page ?
    #6238
    trapaniettech
    Spectator
    I tried with your code above, but the situation has not changed. - When i click on "finish course", i redirect to new page where i see the string "Course Reset for User". Here it is correct --> see the image : http://prnt.sc/8xeiiv and then http://prnt.sc/8xeirb; - given that the course should be reset, i reload the page, but remain the string "finish course"--> see the image : http://prnt.sc/8xejkc; - the only reset function that works, is that of the admin --> see the image : http://prnt.sc/8xeky5 and if i reload the course page : http://prnt.sc/8xel63 1) why the code above don't reset correctly ? 2 ) how i do to apply the same reset function for the user when he/she logs out or when other user opens the single course page and based at current id/ or membership (because i would apply this only a specific user) how you tell me in previous post ? So in this way the course It is always reset
    #6525
    trapaniettech
    Spectator
    hi, you can check your function ? in my site don't work
Viewing 15 posts - 1 through 15 (of 20 total)
  • The topic ‘unset "continue course" and "course finished"’ is closed to new replies.