简体   繁体   English

Moodle:如何通过Web服务启用/配置注册

[英]Moodle: How to enable/configure registration through webservice

I am totally new to moodle. 我完全不喜欢穆德。 Now exploring it to build a LMS. 现在探索它以构建LMS。 Here I need to implement core registration through API, so that user email verification works properly.There is a default API function to create core and moodle use. 在这里,我需要通过API实现核心注册,以便用户电子邮件验证正常工作。有一个默认的API函数可以创建核心和主体使用。 Does any of those types refer to registration? 这些类型中的任何一种都涉及注册吗? If no, is there any way to do user registration through API. 如果否,是否有任何方法可以通过API进行用户注册。

I have found a similar question with accepted answer, where the API function is not mentioned. 我发现了一个类似的问题 ,答案被接受,但未提及API函数。

Even though I'm not convinced I understand the question correctly, I'll give it a try... 即使我不确定我是否正确理解了这个问题,也可以尝试一下...

It's certainly possible to create new users in Moodle through API calls (hopefully that's what you call registration). 当然可以通过API调用在Moodle中创建新用户(希望这就是您所谓的注册)。 You can do it through PHP using function user_create_user() (defined in user/lib.php) and you can do it through a web service, with a call to core_user_create_users. 您可以使用函数user_create_user()(在user / lib.php中定义)通过PHP来实现,也可以通过Web服务并调用core_user_create_users来实现。

Either way, I think it completely bypasses email verification, meaning that Moodle will not check whether the provided email address is valid or not. 无论哪种方式,我都认为它完全绕过了电子邮件验证,这意味着Moodle将不会检查所提供的电子邮件地址是否有效。 If you want a "syntax check", you can call validate_email() (in weblib.php). 如果要“语法检查”,可以调用validate_email()(在weblib.php中)。 There's also send_confirmation_email() (in moodlelib.php) that will send the confirmation email, with link. 还有send_confirmation_email()(在moodlelib.php中)将发送带有链接的确认电子邮件。 You would need to do it manually (and set confirmed to false, when creating the user, to prevent anyone from logging in before having confirmed their email address). 您将需要手动执行此操作(在创建用户时,将Confirm设置为false,以防止任何人在确认其电子邮件地址之前登录)。

(EDIT: looking the linked question..) To use a webservice and trigger the email validation, I would create a new webservice (using a local plugin) to receive the "new user request" and hook into the auth/email plugin. (编辑:查找链接的问题。。)要使用Web服务并触发电子邮件验证,我将创建一个新的Web服务(使用本地插件)以接收“新用户请求”,并连接到auth / email插件。 Actually, you might just want to add a webservice into auth/email...! 实际上,您可能只想将Web服务添加到auth / email中!!

Hopefully this helps. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM