• Resolved landekpeter

    (@landekpeter)


    Hi everyone! Can someone help me figure out how to use code to automatically assign a specific Tutor LMS course to all users? So far, I tried this, but it doesn’t work:

    add_action('init', 'enroll_all_users_in_specific_course'); function enroll_all_users_in_specific_course() { // Retrieve all users $users = get_users(); // Loop through each user foreach ($users as $user) { $user_id = $user->ID; if (function_exists('tutor_utils')) { $course_id = 21897; // Check if the user is already enrolled in the course if (!tutor_utils()->is_enrolled($course_id, $user_id)) { // Use the do_enroll function to enroll the user tutor_utils()->do_enroll($course_id, 0, $user_id); } } } }

    Thanks for your help!

Viewing 1 replies (of 1 total)
  • Hi @landekpeter,

    Thank you for reaching out!

    The functionality you’re looking for would require some level of customization to the existing plugin functionality. Unfortunately, custom coding falls outside our support scope, but I’d be happy to point you in the right direction!

    • Custom Development: You’d need a developer to tailor this functionality for you. I recommend checking out the WordPress Jobs Directory to find experienced developers who can help.
    • Tutor LMS Manual Enrollment: You can use the bulk manual enrollment feature. This might be a more straightforward solution for enrolling users in a specific course without the need for custom code. Please note this is a feature of Tutor LMS Pro.

    Thank you for understanding, and I hope this helps!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.