Note:

This site is no longer used and is in read-only mode. Instead please go to our new Moodle Developer Resource site.

Self Enrolment API: Difference between revisions

From MoodleDocs
Created page with "==Self Enrolment API== The class ''enrol_self_plugin" contains a set of attributes and methods related to moodle self enrolment plugin implementation. ==Methods== ===get_we..."
 
m Text replacement - "</code>" to "</syntaxhighlight>"
 
(3 intermediate revisions by 2 users not shown)
Line 12: Line 12:
This setting can have four possible options:
This setting can have four possible options:


# '''Do not send''' Based on <code>ENROL_DO_NOT_SEND_EMAIL</code> setting and represents not sending welcome email to users.
* '''Do not send''' Based on <syntaxhighlight lang="php">ENROL_DO_NOT_SEND_EMAIL</syntaxhighlight> setting and represents not sending welcome email to users.
# '''Send from course contact''' Matches <code php>ENROL_SEND_EMAIL_FROM_COURSE_CONTACT</code> constant defined on enrollib and depends of course contacs to be set on <code php>$CFG->coursecontact</code>.
* '''Send from course contact''' Matches <syntaxhighlight lang="php">ENROL_SEND_EMAIL_FROM_COURSE_CONTACT</syntaxhighlight> constant defined on enrollib and depends of course contacs to be set on <syntaxhighlight lang="php">$CFG->coursecontact</syntaxhighlight>.
# '''Send from key holder''' Matches <code php>ENROL_SEND_EMAIL_FROM_KEY_HOLDER</code> constant and retrieve contact details from the first user with <code>enrol/self:holdkey</code> capability assigned in the course.
* '''Send from key holder''' Matches <syntaxhighlight lang="php">ENROL_SEND_EMAIL_FROM_KEY_HOLDER</syntaxhighlight> constant and retrieve contact details from the first user with <syntaxhighlight lang="php">enrol/self:holdkey</syntaxhighlight> capability assigned in the course.
# '''Send from no reply address''' If none of those options above return a contact or if the setting is <code php>ENROL_SEND_EMAIL_FROM_NOREPLY<code>, fetch no reply contact for sending.
* '''Send from no reply address''' If none of those options above return a contact or if the setting is <syntaxhighlight lang="php">ENROL_SEND_EMAIL_FROM_NOREPLY<syntaxhighlight lang="php">, fetch no reply contact for sending.


For more information about all possible sending constants and methods, please see [https://docs.moodle.org/dev/Enrolment_API#API_functions Enrolment API document page].
For more information about all possible sending constants and methods, please see [[Enrolment_API]].

Latest revision as of 20:28, 14 July 2021

Self Enrolment API

The class enrol_self_plugin" contains a set of attributes and methods related to moodle self enrolment plugin implementation.

Methods

get_welcome_email_contact()

Find the sender contact details based on enrol_self/sendcoursewelcomemessage setting.

Based on the provided parameters (send option and context) it fetches the contact details and returns the user object that will be used as from address.

This setting can have four possible options:

  • Do not send Based on
    ENROL_DO_NOT_SEND_EMAIL
    
    setting and represents not sending welcome email to users.
  • Send from course contact Matches
    ENROL_SEND_EMAIL_FROM_COURSE_CONTACT
    
    constant defined on enrollib and depends of course contacs to be set on
    $CFG->coursecontact
    
    .
  • Send from key holder Matches
    ENROL_SEND_EMAIL_FROM_KEY_HOLDER
    
    constant and retrieve contact details from the first user with
    enrol/self:holdkey
    
    capability assigned in the course.
  • Send from no reply address If none of those options above return a contact or if the setting is <syntaxhighlight lang="php">ENROL_SEND_EMAIL_FROM_NOREPLY<syntaxhighlight lang="php">, fetch no reply contact for sending.

For more information about all possible sending constants and methods, please see Enrolment_API.