2020-05-18 09:24:09 +00:00
.. _plugins_examples:
2022-02-07 17:11:43 +00:00
========
Examples
========
2020-05-18 09:24:09 +00:00
The following are simple examples of :ref: `Tutor plugins <plugins>` that can be used to modify the behaviour of Open edX.
Skip email validation for new users
2022-02-07 17:11:43 +00:00
===================================
2020-05-18 09:24:09 +00:00
::
2022-02-07 17:11:43 +00:00
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"common-env-features",
"""
"SKIP_EMAIL_VALIDATION": true
2022-05-13 00:56:21 +00:00
"""
2022-02-07 17:11:43 +00:00
)
)
2020-10-06 07:56:51 +00:00
2020-05-18 09:24:09 +00:00
Enable bulk enrollment view in the LMS
2022-02-07 17:11:43 +00:00
======================================
2020-05-18 09:24:09 +00:00
::
2022-02-07 17:11:43 +00:00
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"lms-env-features",
"""
"ENABLE_BULK_ENROLLMENT_VIEW": true
"""
)
)
2020-05-18 09:24:09 +00:00
Enable Google Analytics
2022-02-07 17:11:43 +00:00
=======================
2020-05-18 09:24:09 +00:00
::
2022-02-07 17:11:43 +00:00
from tutor import hooks
2023-05-26 13:26:38 +00:00
hooks.Filters.ENV_PATCHES.add_items([
(
"openedx-common-settings",
"GOOGLE_ANALYTICS_4_ID = 'MY-MEASUREMENT-ID'"
),
(
"mfe-lms-common-settings",
"MFE_CONFIG['GOOGLE_ANALYTICS_4_ID'] = 'MY-MEASUREMENT-ID'"
),
])
.. note ::
Please be aware that as of May 2023 Google Analytics support has been upgraded from Google Universal Analytics to Google Analytics 4 and you may need to update your configuration as mentioned in the `Open edX docs <https://docs.openedx.org/en/latest/site_ops/how-tos/google-analytics.html> `__ .
2020-05-18 09:24:09 +00:00
Enable SAML authentication
2022-02-07 17:11:43 +00:00
==========================
2020-05-18 09:24:09 +00:00
::
2022-02-07 17:11:43 +00:00
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_items([
(
"common-env-features",
'"ENABLE_THIRD_PARTY_AUTH": true',
),
(
2022-06-07 12:10:15 +00:00
"openedx-lms-common-settings",
2022-02-07 17:11:43 +00:00
"""
# saml special settings
AUTHENTICATION_BACKENDS += ["common.djangoapps.third_party_auth.saml.SAMLAuthBackend", "django.contrib.auth.backends.ModelBackend"]
"""
),
(
"openedx-auth",
"""
"SOCIAL_AUTH_SAML_SP_PRIVATE_KEY": "yoursecretkey",
"SOCIAL_AUTH_SAML_SP_PUBLIC_CERT": "yourpubliccert"
"""
),
])
2020-05-18 09:24:09 +00:00
Do not forget to replace "yoursecretkey" and "yourpubliccert" with your own values.