LIMIT Amount of courses a student can join

Home Forums Legacy Support Support queries Other issues LIMIT Amount of courses a student can join

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #68027
    BRALCO
    Spectator
    Hi, Copy of my presale question: So with the code snippet I can enable a feature which limits the amount of courses each student can join? This is very very (!) important. Students may absolutely not join more than 1 course at a time. More specific: when a student join a course, he can’t join an other course anymore. Only after finishing a course, teacher decides when, he can join 1 new course again. So every student can choose between all courses BUT can ONLY join 1 course at a time. (Time is determined by teacher) You confirmed that this would work and you would give me a small code-snippet which enable this feature in the site of my client. So, here I am...;-) Can you please tell me how to make this work? Many many thanks!!! Alice
    #68034
    H.K. Latiyan
    Participant
    Yes this is possible but there are multiple scenarious for this. 1. User joins a course by purchasing. 2. User joins a course as it is free course. 3. Instructor forcefully adds a user to the course from course - admin. 4. User uses the "Course code" or "Apply for course" feature to join the course.   Please state in which all cases you want to restrict the user to join the course.
    #68581
    BRALCO
    Spectator
    Hi Latiyan, Well, nr 2 would do the job for us. Their will be only free courses for the students. Important are the following restrictions: - Student can only take 1 free course. After submit a course (click the big button), he can't subscribe to another one. It's important that the admin can reset this for the student. - Students differences in age and classes/levels. So it would be wonderful if it is possible to restrict content for every User-level. So class-1-students can subscribe once to specific courses for that level. Students of class 4 can subscribe only to specific courses for their level and they can only access the class-4-page with level-4-courses. (Hope you understand what I'm trying to say?? ;-) - Students have to login with a username and password which they receive from school. (For instance Students name + schoolnumber.) So the school has to bulk import all students as members/users with also a subscription/membership level. Students finally has only to login and see their specific page with courses. Hope you can help me out asap....next week I have to finish the job. So unfortunately I'm so in a hurry. Many many many thanks in advance! Great theme.  :-))  
    #68637
    BRALCO
    Spectator
    Hi, The most important restriction is the first one. That students can only follow one course at a time. The other two restrictions, I'm on my way to figure it out myself. Maybe, I got a solution to do this. So, can you just help me out with the first one? Many thanks Alice
    #68693
    H.K. Latiyan
    Participant
    Definitely possible and there is more than 1 way to achieve what you're requesting. ---- The best use case as I understand your requirements. You have classes 1, 2, 3 and Courses , ca1, cb1, cc1 are for class 1 ca2, cb2, cc2 are for class 2 ca3, cb3, cc3 are for class 3 One way to achieve requirement 1, is to set the courses with pre-requisites. for example : Set cb1 course has pre-requisite of ca1, and cc1 has pre-requisite of ca1 and cb1 In the above case the user can only join ca1 course and to join cb1 course first he has to finish the ca1 course, similarly cc1 course can be joined after he has finished cb1. Using this method you can control the students like, first take this course and then take this course and so on. --- If you do not want to use the pre-requisites then we can also provide you with a 3 line code fix to enforce this. --- Divide students into sub groups. We have a premium plugin called "WPLMS Batches" which enables you to divide the students into batches, the best part is that you can force the visibility of courses. So, if you create a batch "Class 1" and connect the course ca1,cb1,cc1 with the batch, then the students of this batch will only see the courses which are connected with the batch. -- Yes, possible, you need to prepare a CSV file for bulk import as shared in this tutorial: https://wplms.io/support/knowledge-base/addingediting-bulk-users-in-a-course/ Note that you can create users, assign them to courses directly on the import but since wplms does not have an inbuilt subscription level, this information would not be possible to bulk import.
    #68826
    BRALCO
    Spectator
    This reply has been marked as private.
    #68943
    H.K. Latiyan
    Participant
    Ok, Please follow the bellow steps: 1) Go to wp-admin->lms->settings->disable auto allocation for free courses, refer: http://prntscr.com/ceclea 2) Please enable this setting and save the settings. 3) Now go to wp-admin->plugins->editor->select wplms customizer plugin->wplms-customizer.php file. 4) Now add the bellow code there:     add_filter('wplms_take_course_button_html','restrict_user_from_taking_course',10,2); function restrict_user_from_taking_course($html,$course_id){   global $wpdb;   if(is_user_logged_in()){     $my_courses_count = bp_course_get_total_course_count_for_user(get_current_user_id());     $finish_course_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(u.meta_value) from {$wpdb->usermeta} as u LEFT JOIN {$wpdb->posts} as p on p.ID = TRIM(LEADING '%s' FROM u.meta_key) WHERE u.meta_value >= %d AND p.post_status = '%s'  AND u.meta_key = CONCAT('%s', p.ID) AND u.user_id = %d",'course_status',4,'publish','course_status',get_current_user_id()));       $my_courses_count = $my_courses_count - $finish_course_count;     if($my_courses_count >= 1){       return '<a href="#" class="full button">Course Not Available</a>';     }else{       return $html;     }   }   return $html; }   5) DONE.   Now user can go to any course and take that course, but the same user cannot take another course if she is already subscribed in atleast 1 course. Let me know if this helps...
    #68993
    BRALCO
    Spectator
    Unfortunately, it doesn't work. :-(( Maybe, because I work with a childtheme? There's another problem. I register a test-user to test this function. I realize that I can't manage subscriptions anywhere. So, I can't unsubscribe the test-user from the course. Where can I do that? It's important that admins and instructors can manually unsubscribe students. I only want a feature that let logged-in students take ONLY 1 free offline course. They can't subscribe to more because all courses startet at the same time. Also it has to be possible for admin and instructors to reset this for each student after a course is finshed or subscribe a student manually to a free course. (When a student can't subscribe by himself because of illness for instance...) Hope you might have an other solution here?  
    #68996
    BRALCO
    Spectator
    Maybe you know a setting like this:  So if students subscribe to a free offline course, the 'take the workshop buttons' of other courses will be hidden for this student?
    #69053
    BRALCO
    Spectator
    Update: manage problem solved. So there's only the subscribe only for 1 free offlline course per student. After taking the course, the buttons of all other courses should be hidden.
    #69089
    BRALCO
    Spectator
    This reply has been marked as private.
    #69090
    BRALCO
    Spectator
    This reply has been marked as private.
    #69109
    H.K. Latiyan
    Participant
    I have made some changes in the above code and updated my reply. Please check and add this new code in your wplms-customizer.php file. The filter used in this code is the take this course button, so make sure you are seeing the take this course button on every course before you take any course. After you subscribe to one course then you will see "Course Not Available" text instead of take this course on the button and clicking on the button will do nothing. Now the student first have to finish the course then only they can take other courses. Let me know if this helps.
    #69110
    H.K. Latiyan
    Participant
    I have tested this on our test setups and it works fine. So please make sure to clean the cache before testing this. If still the issue occurs then please share the site url and the admin credentials with us to check your website and make it work for you. PS: Please mark your reply as private while sharing the admin credentials.
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘LIMIT Amount of courses a student can join’ is closed to new replies.