Hello,
I want to know if there are existant function to add user to existing course ?
Thank in advance.
I hope you are talking about enrolling users into existing course.
Enrolment is handled by different enrolment plugins that you make available in course.
To find available enrolment methods you can use core_enrol_get_course_enrolment_methods API. After this you can enrol users using one out of these available enrolment methods using their enrol_user method. You can find some useful references inside enrollib.php in enrol_plugin class, and inside lib.php files of enrolment plugins.
Thanks