@brianskulls,
Use the LifterLMS REST API to enroll users after you’ve created them. LifterLMS doesn’t care what kind of a user the user is (role) and allows enrollment for users of any role. However, you could use the Students Create endpoint to create the student too (instead of using the WP Core Endpint):
Create a Student: https://developer.lifterlms.com/rest-api/#tag/Students/paths/~1students/post
Enroll a Student: https://developer.lifterlms.com/rest-api/#tag/Student-Enrollments/paths/~1students~1{id}~1enrollments~1{post_id}/post
Any questions let us know,
Thanks for the reaction,
Is it possible to enroll them when i create them?
So I don’t have to first create and then enroll them?
@brianskulls
No, it’s not. The LifterLMS REST API is attempting to be a semantically accurate rest api by having each endpoint responsible for a single resource.
If you can create a student AND an enrollment in a single request that endpoint now becomes semantically incorrect. It manages two resources instead of a single resource.
Having endpoints responsible for multiple resources means more complicated code as a result of more conditions that could occur when using that endpoint.
If each endpoint is only responsible for a single resource we can reduce the conditions and make the code easier to read, understand, use, and maintain.
Any other questions let us know,