Automatic account creation

Automatic account creation

by Mark Bugeja -
Number of replies: 2

Hi, 

I am new to moodle and I am searching for a method that will allow me to automatically generate a new user through an API call. A user registers through a site, once account creation has been confirmed, the details will be sent to the moodle site and the account is generated, with possible redirection done through an email to inform the user that the account has been created.


I found information on manual account creation and mass account creation through CSV, is it possible to do the above?

I apologise if this is a trivial question.

Kind regards

Mark

Average of ratings: -
In reply to Mark Bugeja

Re: Automatic account creation

by Francis Devine -
Picture of Core developers
Hi Mark, there are API's available in moodle core that allow user creation, including a simple rest API

You have to configure them to be available and then add the appropriate functions.
https://docs.moodle.org/dev/Web_services

Then you could write a client to talk to the API endpoint, (with the client most likely embedded in your second site as part of the sign up process)
https://docs.moodle.org/dev/Creating_a_web_service_client

The endpoint you will want to examine the docs for will be

    'core_user_create_users' => array(
        'classname' => 'core_user_external',
        'methodname' => 'create_users',
        'classpath' => 'user/externallib.php',
        'description' => 'Create users.',
        'type' => 'write',
        'capabilities' => 'moodle/user:create'
    ),

Average of ratings: Useful (1)
In reply to Mark Bugeja

Re: Automatic account creation

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
It would also be worth looking at authentication methods, in particular the database method, which allows you to link directly to an external source. You can also map fields from the source table to user profile fields in Moodle if you wanted to flag that someone has been confirmed.

https://docs.moodle.org/400/en/Authentication