<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/402/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leonstr</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/402/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leonstr"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/Special:Contributions/Leonstr"/>
	<updated>2026-05-15T09:04:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=admin/environment/php_extension/intl&amp;diff=146981</id>
		<title>admin/environment/php extension/intl</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=admin/environment/php_extension/intl&amp;diff=146981"/>
		<updated>2025-02-15T11:04:03Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Tidy up formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.&lt;br /&gt;
&lt;br /&gt;
The Intl extension is required in Moodle 3.4 onwards.&lt;br /&gt;
&lt;br /&gt;
== Microsoft Windows ==&lt;br /&gt;
&lt;br /&gt;
To enable this extension add the following line to your php.ini file usually found in /php:&lt;br /&gt;
&lt;br /&gt;
 extension=php_intl.dll&lt;br /&gt;
&lt;br /&gt;
And then set the &#039;&#039;intl.default_locale&#039;&#039; and &#039;&#039;intl.error_level&#039;&#039; directives in your php.ini file.&lt;br /&gt;
&lt;br /&gt;
 [intl]&lt;br /&gt;
 intl.default_locale=en_utf8&lt;br /&gt;
 intl.error_level=E_WARNING&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;intl.error_level&#039;&#039; directive is optional.&lt;br /&gt;
&lt;br /&gt;
In a WAMP installation it may be required to add the php path to the system PATH so that the module4 could uploaded properly (see http://forum.wampserver.com/read.php?2,80704,82499 for a couple of other approaches).&lt;br /&gt;
&lt;br /&gt;
===Problems in Windows 11 VirtualBox virtual machines===&lt;br /&gt;
If you had the &#039;&#039;msvcp110.dll missing file error&#039;&#039;, you added that file and then you got the &#039;&#039;intl missing error&#039;&#039; which can not be solved by doing the above instructions, you need to go to http://www.microsoft.com/es-es/download/confirmation.aspx?id=30679 and install the vcredist_x64.exe and vcredist_x86.exe, as described in https://stackoverflow.com/a/18876880&lt;br /&gt;
&lt;br /&gt;
==Other operating systems==&lt;br /&gt;
&lt;br /&gt;
Use system package manager or specify compilation flag.&lt;br /&gt;
&lt;br /&gt;
*Debian 5.0 (&amp;amp; Ubuntu) use: &#039;&#039;&#039;apt-get install php-intl&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*CentOS 8.0 (&amp;amp; Red Hat) use: &#039;&#039;&#039;dnf install php-intl&#039;&#039;&#039;. CentOS 7.0 (&amp;amp; Red Hat) use: &#039;&#039;&#039;yum install php-intl&#039;&#039;&#039;. The package name may be slightly different depending on the repository used for PHP packages, e.g. &#039;&#039;&#039;php74-intl&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://www.php.net/manual/en/intro.intl.php INTL Introduction]&lt;br /&gt;
*[http://www.php.net/manual/en/book.intl.php PHP Internationalization Functions]&lt;br /&gt;
*[https://docs.moodle.org/en/Table_of_locales Table of locales] lists the locales that you can use.&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment|PHP]]&lt;br /&gt;
&lt;br /&gt;
[[fr:admin/environment/php extension/intl]]&lt;br /&gt;
[[es:admin/environment/php extension/intl]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Quiz_submission_email_notification&amp;diff=146837</id>
		<title>Quiz submission email notification</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Quiz_submission_email_notification&amp;diff=146837"/>
		<updated>2023-11-08T15:35:57Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Allow Quiz notification messages to teachers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz}}&lt;br /&gt;
It is possible for a message to be sent out to confirm that the student submitted the quiz.&lt;br /&gt;
&lt;br /&gt;
There are two types of notification:&lt;br /&gt;
#A confirmation to the student that their attempt has finished successfully&lt;br /&gt;
#A notification to the teacher(s) that someone has submitted an attempt. Messages are never sent for preview attempts.&lt;br /&gt;
&lt;br /&gt;
Note that although the capabilities are  &amp;quot;emailnotifysubmission/emailconfirmsubmission&amp;quot; the notifications do NOT have to be via email. The notifications come via Moodle&#039;s messaging system. Admins can set the defaults from &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Message outputs &amp;gt; Default message outputs&#039;&#039; to enable/disable email/pop up notification.&lt;br /&gt;
{|&lt;br /&gt;
|  [[File:quizsubmissionnotificationdefault.png|thumb|Quiz submission notification default settings]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See [[Messaging settings]] for more details. (Notification messages in Moodle quiz are disabled by default.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Allow Quiz notification messages to teachers==&lt;br /&gt;
&lt;br /&gt;
To do this for an individual quiz, click into the quiz, click the gear icon top right and click Permissions (Boost theme) or for other themes, click Permissions from the Quiz administration block.&lt;br /&gt;
&lt;br /&gt;
This may also be done on the site level by the administrator in  &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles &amp;gt; Teacher&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#In the filter, type &amp;quot;email&amp;quot; to locate the capability &amp;quot;mod/quiz:emailnotifysubmission&amp;quot;&lt;br /&gt;
#Click on the + for &amp;quot;Roles with permission&amp;quot;&lt;br /&gt;
#On the next screen, select Teacher and click &amp;quot;Allow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:QuizEmailNotifySub.png]]&lt;br /&gt;
===Messages in a specific quiz to specific teacher(s)===&lt;br /&gt;
The system administrator will need to create a new role, and allow the capability &#039;&#039;mod/quiz:emailnotifysubmission&#039;&#039; for that role.  Do not give the capability to the teacher&#039;s role on the system or course level.  The new role is similar to a teacher&#039;s role and should be available on the activity level.&lt;br /&gt;
&lt;br /&gt;
In the course, go to the quiz and the quiz administration&amp;gt;locally assigned roles, assign the user(s) that should get emails/messages for a submitted quiz to the new role.&lt;br /&gt;
&lt;br /&gt;
==Allow confirmation messages to students==&lt;br /&gt;
To do this for an individual quiz, go to:&lt;br /&gt;
&#039;&#039;Administration &amp;gt; Quiz administration &amp;gt; Permissions&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
This may also be done on the site level by the administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles &amp;gt; Student&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#In the Capability column under &#039;&#039;Activity: Quiz&#039;&#039; find the capability &#039;&#039;mod/quiz:emailconfirmsubmission&#039;&#039;&lt;br /&gt;
#Click on the + &lt;br /&gt;
#On the next screen, select Student and click &amp;quot;Allow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[File:studentno.png|thumb|1. Click the + to add a role]]&lt;br /&gt;
| [[File:studentadd.png|thumb|2. Select Student and click &amp;quot;Allow&amp;quot;]]&lt;br /&gt;
| [[File:studentyes.png|thumb|3. Students will now receive messages]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
:Note that if the quiz is set to separate groups, then teachers will only get a notification if either&lt;br /&gt;
* the student is in the same group as the teacher, or&lt;br /&gt;
* the teacher has moodle/site:accessallgroups.&lt;br /&gt;
&lt;br /&gt;
==How to configure the text of the messages==&lt;br /&gt;
&#039;&#039;Administration &amp;gt; Site administration &amp;gt; Language &amp;gt; Language customization&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This can only be done by a user that has permission to alter the language files.   To reconfigure the way the email reads, you will need to understand string variables and how they work as part of another string.  While not complicated, this will require attention to detail.  This section assumes you also have read [[Language customization]].&lt;br /&gt;
&lt;br /&gt;
The subject and body of the emails are defined in the quiz.php language file that are in the &amp;quot;mod&amp;quot; group. The strings to edit are &#039;emailconfirmsubject&#039;, &#039;emailconfirmbody&#039;, &#039;emailnotifysubject&#039; and &#039;emailnotifybody&#039;. The $a string passed in when these language strings are loaded contains all the following information:&lt;br /&gt;
&lt;br /&gt;
===The emailconfirmbody string===&lt;br /&gt;
&amp;lt;nowiki&amp;gt; Dear {$a-&amp;gt;username}, Thank you for submitting your answers to &#039;{$a-&amp;gt;quizname}&#039; in course &#039;{$a-&amp;gt;coursename}&#039; at    {$a-&amp;gt;submissiontime}. This message confirms that we have safely received your answers. You can access this quiz at {$a-&amp;gt;quizurl}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The emailnotifybody string===&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Dear {$a-&amp;gt;username}, {$a-&amp;gt;studentname} has completed the quiz &#039;{$a-&amp;gt;quizname}&#039; ({$a-&amp;gt;quizurl}) in course &#039;{$a-&amp;gt;coursename}&#039; You can review this attempt at {$a-&amp;gt;quizreviewurl}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The emailnotifysmall===&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{$a-&amp;gt;studentname} has completed {$a-&amp;gt;quizname}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The emailnotifysubject string===&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Quiz submission confirmation: {$a-&amp;gt;quizname}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Potential strings to use in an email===&lt;br /&gt;
;$a-&amp;gt;coursename&lt;br /&gt;
:The name of the course&lt;br /&gt;
;$a-&amp;gt;courseshortname&lt;br /&gt;
:The shortname of the course&lt;br /&gt;
;$a-&amp;gt;quizname&lt;br /&gt;
:The name of the quiz&lt;br /&gt;
;$a-&amp;gt;quizreporturl&lt;br /&gt;
:The URL of the results overview for this quiz (.../mod/quiz/report.php?q=&#039;&#039;quizid&#039;&#039;)&lt;br /&gt;
;$a-&amp;gt;quizreportlink&lt;br /&gt;
:The URL of the results overview URL and quiz name as a HTML link&lt;br /&gt;
;$a-&amp;gt;quizreviewurl&lt;br /&gt;
:The URL of the review page for this attempt (.../mod/quiz/review.php?attempt=&#039;&#039;attemptid&#039;&#039;)&lt;br /&gt;
;$a-&amp;gt;quizreviewlink&lt;br /&gt;
:The attempt review URL and quiz name as a HTML link&lt;br /&gt;
;$a-&amp;gt;quizurl&lt;br /&gt;
:The URL of the main page of the quiz (.../mod/quiz/view.php?q=&#039;&#039;quizid&#039;&#039;)&lt;br /&gt;
;$a-&amp;gt;quizlink&lt;br /&gt;
:The URL of the quiz and the quiz name as a HTML link&lt;br /&gt;
;$a-&amp;gt;attemptsubmissiontime&lt;br /&gt;
:The time the attempt was submitted, formatted using userdate().&lt;br /&gt;
;$a-&amp;gt;timetaken&lt;br /&gt;
:How long the quiz attempt lasted.&lt;br /&gt;
;$a-&amp;gt;studentname&lt;br /&gt;
:The name of the person who submitted the quiz.&lt;br /&gt;
;$a-&amp;gt;studentidnumber&lt;br /&gt;
:The idnumber of the person who submitted the quiz.&lt;br /&gt;
;$a-&amp;gt;studentusername&lt;br /&gt;
:The username of the person who submitted the quiz.&lt;br /&gt;
;$a-&amp;gt;username&lt;br /&gt;
:The name of the user the email is being sent to.&lt;br /&gt;
;$a-&amp;gt;useridnumber&lt;br /&gt;
:The idnumber of the user the email is being sent to.&lt;br /&gt;
;$a-&amp;gt;userusername&lt;br /&gt;
:The username of the user the email is being sent to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[ja:解答送信の通知メール]]&lt;br /&gt;
[[de:E-Mail-Benachrichtigung bei Testabgabe]]&lt;br /&gt;
[[es:Notificación Email sobre envío de examen]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Feedback_settings&amp;diff=146836</id>
		<title>Feedback settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Feedback_settings&amp;diff=146836"/>
		<updated>2023-11-08T11:42:41Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Map feedback to courses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Feedback}}&lt;br /&gt;
This page explores in more detail the settings for the Feedback activity once you have added it to your course and also covers the Site administration settings.&lt;br /&gt;
&lt;br /&gt;
The Feedback activity is enabled by default in new sites but if you don&#039;t see it in a course, ask your administrator to check if it is disabled site wide.&lt;br /&gt;
&lt;br /&gt;
The [[Feedback block]] works with the [[Feedback activity]] to display a list of global Feedback activities associated with a course. &lt;br /&gt;
==General==&lt;br /&gt;
In the Description, provide instructions for students. Check the box if you want these instructions to display on the course page.&lt;br /&gt;
==Availability==&lt;br /&gt;
Here you can choose when users can complete feedback.&lt;br /&gt;
==Question and submission settings==&lt;br /&gt;
:Record user names&lt;br /&gt;
:Choose here whether to show the names of users who complete the feedback or not.&lt;br /&gt;
;Allow multiple submissions&lt;br /&gt;
:Choose here whether or not to allow users to complete the feeback more than once. This is important when using Feedback for anonymous surveys on the front page as it will allow non-logged in users to complete the feedback.&lt;br /&gt;
;Enable notification of submissions&lt;br /&gt;
:If set to &#039;Yes&#039; then teachers will receive notifications when users submit feedback.&lt;br /&gt;
;Auto-number questions&lt;br /&gt;
:If set to &#039;Yes&#039; then the questions will be automatically numbered.&lt;br /&gt;
==After submission==&lt;br /&gt;
;Show analysis page&lt;br /&gt;
:Choose whether to show students the analyis page or only show to teachers.&lt;br /&gt;
;Completion message&lt;br /&gt;
:Type a personalised message here that students will read after completing the feedback.&lt;br /&gt;
;Link to next activity&lt;br /&gt;
:This allows you to add a URL to another activity or webpage which you would like them to go to once they have answered the questions.  &lt;br /&gt;
&#039;&#039;Note:&#039;&#039; Neither of the above fields is required for a student to answer the questions, but they must click the &#039;&#039;&#039;Answer the questions...&#039;&#039;&#039; link to start the Feedback activity.&lt;br /&gt;
==Other settings==&lt;br /&gt;
Depending on what is enabled for your site and course, you may also need to explore [[Common module settings]], [[Restrict access| Restrict access]], [[Activity completion]], [[Tags]] and [[Competencies]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map feedback to courses==&lt;br /&gt;
If a feedback instance is added to the front page there is an option, when &#039;Save and display&#039; is clicked, to map the feedback to courses. All courses or certain courses may be selected. (In other words, if you only want the feedback to be available in certain courses but not all, you would choose just those courses.) The [[Feedback block]] can then be added to those courses and it provides a quick link to the Feedback activity.&lt;br /&gt;
&lt;br /&gt;
To map to a course, first type in the name of a course and press the Search button. You will then be presented with a drop down menu from which you may choose your course. Click the &#039;map feedback&#039; button to add it. Repeat this to add another course. If you don&#039;t choose a course then the feedback will be mapped to all courses by default.&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
The Feedback activity has additional settings which may be changed by an administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Feedback&#039;&#039;.&lt;br /&gt;
===Allow full anonymous===&lt;br /&gt;
Changing this setting to &amp;quot;yes&amp;quot; permits non-logged in users on the front page to complete a feedback activity. Notice that anonymous feedback is not anonymous in the sense that [[GDPR]] describes it.&lt;br /&gt;
==Feedback capabilities==&lt;br /&gt;
*[[Capabilities/mod/feedback:complete|Complete a feedback]]&lt;br /&gt;
*[[Capabilities/mod/feedback:createprivatetemplate|Create private template]]&lt;br /&gt;
*[[Capabilities/mod/feedback:createpublictemplate|Create public template]]&lt;br /&gt;
*[[Capabilities/mod/feedback:deletesubmissions|Delete completed submissions]]&lt;br /&gt;
*[[Capabilities/mod/feedback:deletetemplate|Delete template]]&lt;br /&gt;
*[[Capabilities/mod/feedback:edititems|Edit items]]&lt;br /&gt;
*[[Capabilities/mod/feedback:mapcourse|Map courses to global feedbacks]]&lt;br /&gt;
*[[Capabilities/mod/feedback:receivemail|Receive email notification]]&lt;br /&gt;
*[[Capabilities/mod/feedback:view|View a feedback]]&lt;br /&gt;
*[[Capabilities/mod/feedback:viewanalysepage|View the analysis page after submit]]&lt;br /&gt;
*[[Capabilities/mod/feedback:viewreports|View reports]]&lt;br /&gt;
*[[Capabilities/mod/feedback:addinstance|Add a new feedback]]&lt;br /&gt;
[[de:Feedback konfigurieren]]&lt;br /&gt;
[[es:Configuraciones de retroalimentación]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Course_copy&amp;diff=146496</id>
		<title>Course copy</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Course_copy&amp;diff=146496"/>
		<updated>2023-08-10T15:52:45Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Course copy was always async so unaffected by enableasyncbackup, asynchronous_copy_task is an adhoc task so cannot be disabled&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==About course copy==&lt;br /&gt;
Administrators, managers and those with the relevant capabilities can quickly copy courses from a course category or within a course.&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/-V8z3jlOygc| desc = Course copy}}&lt;br /&gt;
&lt;br /&gt;
==Course copy from Course and category management screen==&lt;br /&gt;
# From &#039;&#039;Site administration / Courses / Manage courses and categories&#039;&#039;, click to select a category.&lt;br /&gt;
# Find the course you want to copy, and click the duplicate icon to copy the course.&lt;br /&gt;
&lt;br /&gt;
[[File:CategoryCopyCourse.png|center|Copying courses from a category]]&lt;br /&gt;
&lt;br /&gt;
==Course copy from within a course==&lt;br /&gt;
# Access the course you want to copy.&lt;br /&gt;
# From Course navigation &amp;gt; More &amp;gt; Course reuse, select &#039;Course copy&#039;.&lt;br /&gt;
&lt;br /&gt;
==Course copy settings==&lt;br /&gt;
As well as setting the course name, category, visibility and dates, you can  make the following selections:&lt;br /&gt;
* Include user data - Similar to in a course backup, you can decide whether or not to include the data of any users with the roles in your course who will be included in the next setting.&lt;br /&gt;
* Include role enrolments - If you select a role here then users with that role will be enrolled into the copied course, either with or without their user data, depending on the previous setting.&lt;br /&gt;
&lt;br /&gt;
==Allow teachers to copy courses==&lt;br /&gt;
To allow a course teacher (or any role other than an admin or manager) to copy courses, the role needs the following capabilities:&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/moodle/backup:backupcourse]]&lt;br /&gt;
* [[Capabilities/moodle/restore:restorecourse]]&lt;br /&gt;
* [[Capabilities/moodle/course:view]]&lt;br /&gt;
* [[Capabilities/moodle/course:create]]&lt;br /&gt;
&lt;br /&gt;
Besides, if you want they can include user data (i.e. keep role enrolments), the role will need the following capabilities too:&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/moodle/restore:createuser]]&lt;br /&gt;
* [[Capabilities/moodle/backup:userinfo]]&lt;br /&gt;
* [[Capabilities/moodle/restore:userinfo]]&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
If course copying fails to complete, please check [[Cron]] is running every minute&lt;br /&gt;
&lt;br /&gt;
If there is a quiz in the course and you are a teacher or manager this feature does not currently work. For more information see MDL-69941&lt;br /&gt;
&lt;br /&gt;
[[es:Copia del curso]]&lt;br /&gt;
[[de:Kurs kopieren]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Dashboard&amp;diff=146493</id>
		<title>Dashboard</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Dashboard&amp;diff=146493"/>
		<updated>2023-08-08T09:07:30Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* See also */ &amp;quot;The content of this forum post has been removed and can no longer be accessed&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Site appearance}}&lt;br /&gt;
==About the Dashboard==&lt;br /&gt;
The Dashboard is a customisable page for providing users with details of their progress and upcoming deadlines. &lt;br /&gt;
&lt;br /&gt;
The default dashboard includes a [[Timeline block|Timeline]], [[Calendar]] and from the Block drawer, the [[Recently accessed items block]].&lt;br /&gt;
&lt;br /&gt;
Quick access to Dashboard is also available from the site navigation at the top of the  screen once logged in.&lt;br /&gt;
&lt;br /&gt;
Users can normally customise their Dashboard, adding or removing blocks and changing block positions. They can revert their Dashboard back to the original blocks as follows:&lt;br /&gt;
&lt;br /&gt;
# Activate the &#039;Edit mode&#039; switch.&lt;br /&gt;
# Click the &#039;Reset page to default&#039; button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Note that an administrator can reset the Dashboard for all users from &#039;Default Dashboard page&#039; in the Site administration).&lt;br /&gt;
==Hiding the Dashboard==&lt;br /&gt;
If deadlines and calendar events are not used in your site then the Dashboard may be removed from the top navigation from Site administration &amp;gt; Appearance &amp;gt; Navigation and unchecking &#039;Enable Dashboard&#039;. A different home page can then be set for users.&lt;br /&gt;
&lt;br /&gt;
==Default home page==&lt;br /&gt;
&lt;br /&gt;
For new installations, Dashboard is the default home page for logged in users. An administrator can change the default home page  in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Navigation&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If &#039;User preference&#039; is selected as default home page, each user needs to set the desired page – Home, My courses or Dashboard – under User menu &amp;gt; Preferences &amp;gt; User account &amp;gt; Home page. Once selected, Moodle will remember which page to present them each time they log on.&lt;br /&gt;
&lt;br /&gt;
[[File:defaulthomepagelink.png|300px]]&lt;br /&gt;
&lt;br /&gt;
==Setting the default Dashboard==&lt;br /&gt;
&lt;br /&gt;
An administrator or manager (or other user with the capability [[Capabilities/moodle/my:configsyspages|moodle/my:configsyspages]]) can set the default blocks  for all users from  &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Default Dashboard page&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Clicking the button &#039;Reset Dashboard for all users&#039; will then apply these settings to the Dashboard for everyone on the site.&lt;br /&gt;
&lt;br /&gt;
Default blocks are:&lt;br /&gt;
* [[Navigation block|Navigation]]&lt;br /&gt;
* [[Administration block|Administration]]&lt;br /&gt;
* [[Course overview block|Course overview]]&lt;br /&gt;
* [[Private files block|Private files]]&lt;br /&gt;
* [[Latest badges block|Latest badges]]&lt;br /&gt;
* [[Calendar block|Calendar]]&lt;br /&gt;
* [[Upcoming events block|Upcoming events]]&lt;br /&gt;
* [[Online users block|Online users]]&lt;br /&gt;
&lt;br /&gt;
==Preventing users from customizing their Dashboard==&lt;br /&gt;
&lt;br /&gt;
By default, users can customize their Dashboard and add blocks. An admin can prevent this as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;&lt;br /&gt;
# Edit the authenticated user role and untick the [[Capabilities/moodle/my:manageblocks|Manage Dashboard blocks capability]]&lt;br /&gt;
&lt;br /&gt;
==Dashboard capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/moodle/my:manageblocks|Manage Dashboard blocks]] (see above)&lt;br /&gt;
* [[Capabilities/moodle/my:configsyspages|Configure system templates for Dashboard]]&lt;br /&gt;
&lt;br /&gt;
In addition, all blocks which may be added to a Dashboard have a &#039;&#039;myaddinstance&#039;&#039; capability (e.g. [[Capabilities/block/comments:myaddinstance|block/comments:myaddinstance]]) for controlling whether a user with a particular role can add the block.&lt;br /&gt;
&lt;br /&gt;
==Preventing users from adding a block to their Dashboard==&lt;br /&gt;
&lt;br /&gt;
By default, users can add many blocks to their Dashboard. An admin can prevent them from adding a particular block, such as the [[Online users block]], as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;&lt;br /&gt;
# Edit the authenticated user role and untick the [[Capabilities/block/online users:myaddinstance|Add a new online users block to the Dashboard capability]]&lt;br /&gt;
&lt;br /&gt;
==Blocks not available on the Dashboard==&lt;br /&gt;
&lt;br /&gt;
The following blocks may not be added to a user&#039;s Dashboard (because it wouldn&#039;t make sense):&lt;br /&gt;
&lt;br /&gt;
*[[Course completion status block]]&lt;br /&gt;
*[[Course/site summary block]]&lt;br /&gt;
*[[Self completion block]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=340126 Show Categories of courses on Dashboard after sign in] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[eu:Nire_Moodle]]&lt;br /&gt;
[[fr:Tableau de bord]]&lt;br /&gt;
[[de:Dashboard]]&lt;br /&gt;
[[es:Tablero]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=MySQL_full_unicode_support&amp;diff=146490</id>
		<title>MySQL full unicode support</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=MySQL_full_unicode_support&amp;diff=146490"/>
		<updated>2023-08-07T10:43:22Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* UTF-8 */ Added note about utf8 in recent MySQL/MariaDB versions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
==UTF-8==&lt;br /&gt;
&lt;br /&gt;
UTF-8 is a character encoding that most websites use. It encodes each of the 1,112,064 valid code points. To store all of this information, four bytes is required. The most popular values are in the three byte region. MySQL by default only uses a three byte encoding and so values in the four byte range (e.g. Asian characters and Emojis) can not be stored. Any attempt to enter a text that contains four byte characters will result in a Moodle database error.&lt;br /&gt;
&lt;br /&gt;
MySQL does provide full four byte UTF-8 support, but it requires certain database settings to be configured. From version 3.3 on Moodle uses full UTF-8 for both MySQL and MariaDB by default. Existing databases will still run with partial support, but it is recommended to move over to full support.&lt;br /&gt;
&lt;br /&gt;
Moodle comes with a Command Line Interface (CLI) script for converting to full UTF-8 for MySQL (and MariaDB). Before Moodle versions 3.1.5 and 3.2.2 this conversion tool would only change the Collation to some variant of &#039;utf8_bin&#039;. &#039;utf8_unicode_ci&#039; was the recommended Collation. We now recommend using &#039;utf8mb4_unicode_ci&#039; which supports four byte characters (utf8_unicode_ci only supports three).&lt;br /&gt;
&lt;br /&gt;
This script will attempt to change the database Collation, Character set, default table settings and column definitions.&lt;br /&gt;
&lt;br /&gt;
To summarise:&lt;br /&gt;
&lt;br /&gt;
* Fresh installs of Moodle will use utf8mb4 by default, if the database server is configured appropriately (see below).&lt;br /&gt;
* Sites upgrading to Moodle versions beyond 3.1.5 or 3.2.2 can use the script to update to utf8mb4. In Moodle 3.3 onwards a warning will show that the database isn&#039;t using full UTF-8 support and suggest moving to &#039;utf8mb4_unicode_ci&#039;.&lt;br /&gt;
* You may choose to keep using &#039;utf8_*&#039; unless you have MySQL 8.0.28 or later, or MariaDB 10.6.1 or later, in which case you must update to utf8mb4 (because utf8 was renamed to utf8mb3 in these versions, see MDL-74616).&lt;br /&gt;
&lt;br /&gt;
===File format===&lt;br /&gt;
&lt;br /&gt;
To allow for large indexes on columns that are a varchar, a combination of settings needs to be set. The file format for the system needs to be using &amp;quot;Barracuda&amp;quot;. This allows for the row format to be set to &amp;quot;Compressed&amp;quot; or &amp;quot;Dynamic&amp;quot;. To enable this setting see the upgrade steps listed below. Moodle will not install if you have large format enabled without the Barracuda file format.&lt;br /&gt;
&lt;br /&gt;
===File per table===&lt;br /&gt;
&lt;br /&gt;
To enable this setting see the upgrade steps listed below.&lt;br /&gt;
&lt;br /&gt;
===Large prefix===&lt;br /&gt;
&lt;br /&gt;
This in conjunction with the row format being either &amp;quot;Compressed&amp;quot; or &amp;quot;Dynamic&amp;quot; allows for large varchar indexes above 191 characters.&lt;br /&gt;
To enable this setting see the upgrade steps listed below.&lt;br /&gt;
&lt;br /&gt;
==Steps to upgrade==&lt;br /&gt;
&lt;br /&gt;
Most important: Please backup your database before making any changes or running the CLI script.&lt;br /&gt;
&lt;br /&gt;
* Change configuration settings for MySQL (exactly the same for MariaDB). This step is optional. You can run the script and it will try and make these changes itself. If errors occur then try manually changing these settings as listed below.&lt;br /&gt;
** On Linux based systems you will want to alter my.cnf. This may be located in &#039;/etc/mysql/&#039;.&lt;br /&gt;
** Make the following alterations to my.cnf:&lt;br /&gt;
&lt;br /&gt;
Important Change; InnoDB: The following InnoDB file format configuration options were deprecated in MySQL 5.7.7 and are now removed:&lt;br /&gt;
&lt;br /&gt;
    innodb_file_format&lt;br /&gt;
&lt;br /&gt;
    innodb_file_format_check&lt;br /&gt;
&lt;br /&gt;
    innodb_file_format_max&lt;br /&gt;
&lt;br /&gt;
    innodb_large_prefix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
innodb_file_format = Barracuda&lt;br /&gt;
innodb_file_per_table = 1&lt;br /&gt;
innodb_large_prefix = true&lt;br /&gt;
&lt;br /&gt;
character-set-server = utf8mb4&lt;br /&gt;
collation-server = utf8mb4_unicode_ci&lt;br /&gt;
skip-character-set-client-handshake&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* Restart your MySQL server.&lt;br /&gt;
* Run the CLI script to convert to the new character set and collation (requires Moodle 3.1.5, 3.2.2 or newer): &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Make sure to repair and optimize all databases and tables.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysqlcheck -u root -p --auto-repair --optimize --all-databases&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
NOTE: On very large sites this may take a long time to run. You should probably establish how long on a test install before taking your live site offline. In some cases you might consider dumping and re-importing your data.&lt;br /&gt;
&lt;br /&gt;
* Adjust the $CFG-&amp;gt;dboptions array in your &#039;&#039;&#039;config.php&#039;&#039;&#039; to make sure that Moodle uses the right collation when connecting to the MySQL Server: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;dboptions = array(&lt;br /&gt;
  &amp;amp;hellip;&lt;br /&gt;
  &#039;dbcollation&#039; =&amp;gt; &#039;utf8mb4_unicode_ci&#039;,&lt;br /&gt;
  &amp;amp;hellip;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you only have access to the database command line (or something like phpMyaAdmin) you can try the following SQL commands:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SET GLOBAL innodb_file_format = barracuda;&lt;br /&gt;
&lt;br /&gt;
SET GLOBAL innodb_file_per_table = 1;&lt;br /&gt;
&lt;br /&gt;
SET GLOBAL innodb_large_prefix = &#039;on&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try adding some Emojis (e.g. 😂💩) to your Moodle site to verify that the upgrade was successful.&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment|UTF-8]]&lt;br /&gt;
[[Category:UTF-8]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:MySQL soporte unicode completo]]&lt;br /&gt;
[[fr:Support unicode complet pour MySQL]]&lt;br /&gt;
[[de:MySQL Unicode Unterstützung]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=MoodleDocs:Style_guide&amp;diff=146427</id>
		<title>MoodleDocs:Style guide</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=MoodleDocs:Style_guide&amp;diff=146427"/>
		<updated>2023-07-15T09:22:08Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Replace &amp;lt;code&amp;gt; with &amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Help}}&lt;br /&gt;
==Describing the location of items==&lt;br /&gt;
&lt;br /&gt;
* A site admin setting may be referred to as, for example, the setting &#039;Maximum uploaded file size&#039; in &#039;Site policies&#039; in Site administration&lt;br /&gt;
* In the Boost theme, we have a navigation drawer and a gear menu. In the Classic theme we have a &#039;Course administration&#039;&lt;br /&gt;
* In 3.2 we have a menu bar containing a notifications menu and a messages menu&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* Grades in the navigation drawer&lt;br /&gt;
* Groups from the gear menu on the Participants page&lt;br /&gt;
* &#039;Add a new badge&#039; from the More... link in the gear menu on the course page&lt;br /&gt;
* Messages in the user menu&lt;br /&gt;
&lt;br /&gt;
== Categories ==&lt;br /&gt;
A category is an index of documentation pages.&lt;br /&gt;
&lt;br /&gt;
* A page can be added to a category by typing &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Category name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Site administration]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, at the bottom of the page. Many templates automatically categorise pages using the template, for example &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Template:Forum]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; categorises pages into [[:Category:Forum]].&lt;br /&gt;
* For &#039;&#039;&#039;linking to a category&#039;&#039;&#039; you have to add another colon like so: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[:Category:FAQ]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; which will show as [[:Category:FAQ]].&lt;br /&gt;
* [[Special:Categories|Categories]] lists all Moodle Docs categories. This can be found in the Toolbox Special pages link.&lt;br /&gt;
* For &#039;&#039;&#039;further information&#039;&#039;&#039; about categories and how they work in MediaWiki, please refer to the [https://en.wikipedia.org/wiki/Wikipedia:Categorization Wikipedia:Categorization].&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
* You are encouraged to illustrate documentation with screenshots. Please use the official [https://sandbox.moodledemo.net/ Moodle demo site], or any other site or course using one of the standard themes, and ensure that the screenshot is as small as possible.&lt;br /&gt;
* Screenshots should be GIF, JPEG or PNG format, with 72ppi resolution, and maximum width 800px.&lt;br /&gt;
* To fit more into a screenshot, select a smaller text size for the web page via the View &amp;gt; Text size menu in your web browser. &lt;br /&gt;
* Screenshots can be uploaded using the toolbox [[Special:Upload|Upload file]] link.&lt;br /&gt;
* Please name screenshots descriptively to avoid confusion.&lt;br /&gt;
* To include the screenshot in an article, use a link in the form &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[File:Screenshot.png|thumb|alt text]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Please do not apply effects such as borders, watermarks or drop shadows to screenshots. This will allow others to add or replace screenshots over time and still maintain a consistent look and feel to articles.&lt;br /&gt;
* You can duplicate the look of the [http://school.moodledemo.net/ Mount Orange School] used in many Moodle documentation pages by following [[Standard_themes#Mount_Orange:_example_of_a_customised_More_theme|these  instructions]].&lt;br /&gt;
* For help on image placement and adding an image caption, please refer to the [https://en.wikipedia.org/wiki/Wikipedia:Picture_tutorial Wikipedia Picture tutorial].&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
* In MediaWiki, a template is a page which can be inserted into another page. For example, the Moodle Docs help block on this page is a template.&lt;br /&gt;
* A template may be added to a page by typing &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{Name}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for Template:&#039;&#039;Name&#039;&#039; (template names are case sensitive).&lt;br /&gt;
* [https://docs.moodle.org/en/index.php?title=Special%3AAllpages&amp;amp;from=&amp;amp;namespace=10 All pages (Template namespace)] lists all Moodle Docs templates.&lt;br /&gt;
* Please refer to the [http://meta.wikimedia.org/wiki/Help:Template MediaWiki Template help] for further information.&lt;br /&gt;
&lt;br /&gt;
==Moodle Docs editing tags==&lt;br /&gt;
*[[MoodleDocs:Deletion|Deletion]] - If you find any page requiring deletion, type &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{Deletion}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; at the top of the page.  Use the page comments if necessary to state the reason for deletion.&lt;br /&gt;
*[[MoodleDocs:Update|Update]] - Features increase with each Moodle version. If you find a page requiring updating, type &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{Update}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; at the top of the page.&lt;br /&gt;
*[[:MoodleDocs:Stub|Stub]] - Developers and Moodle Docs administrators may add a new page with a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{Stub}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tag at the top, requesting help in adding content.&lt;br /&gt;
*You can also use the [[Help:Editing#Edit_summary|edit summary]] to communicate the need for more editing. For example, in the page history you might see: &amp;quot;Added section, needs more work, see page comments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== PHP syntax highlighting ==&lt;br /&gt;
&lt;br /&gt;
* To highlight PHP syntax, enclose the code in tags: &lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;... Some PHP code here...&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will be rendered as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/../../config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$cmid = required_param(&#039;cmid&#039;, 0, PARAM_INT);&lt;br /&gt;
if (!$cm = get_coursemodule_from_id(&#039;quiz&#039;, $id)) {&lt;br /&gt;
    print_error(&#039;invalidcoursemodule&#039;);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For long code examples you can even add &#039;&#039;&#039;line numbering&#039;&#039;&#039; like so: &lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; line&amp;gt;... A lot of PHP code here...&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will be rendered as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; line&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/../../config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$cmid = required_param(&#039;cmid&#039;, 0, PARAM_INT);&lt;br /&gt;
if (!$cm = get_coursemodule_from_id(&#039;quiz&#039;, $id)) {&lt;br /&gt;
    print_error(&#039;invalidcoursemodule&#039;);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* But beware, line numbering makes copying &amp;amp; pasting of code examples more cumbersome!&lt;br /&gt;
&lt;br /&gt;
== CSS syntax highlighting ==&lt;br /&gt;
&lt;br /&gt;
* To highlight CSS syntax, enclose the code in tags: &lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;... Some CSS code here...&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.que .info .grade { display: none; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* You can see many examples of this in [https://docs.moodle.org/402/en/index.php?title=Quiz_FAQ&amp;amp;action=edit the Quiz FAQ Doc page]. &lt;br /&gt;
* See also the documentation on [[Code syntax highlighting]] that uses the GeSHi (Generic Syntax Highlighter) filter.&lt;br /&gt;
&lt;br /&gt;
[[Category:MoodleDocs|Style guide]]&lt;br /&gt;
[[de:Moodle Docs StyleGuide]]&lt;br /&gt;
[[es:MoodleDocs:Guía de Estilo]]&lt;br /&gt;
[[fr:MoodleDocs:Guide de style]]&lt;br /&gt;
[[ja:MoodleDocs:スタイルガイド]]&lt;br /&gt;
[[zh:MoodleDocs:风格指引]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=MySQL&amp;diff=146423</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=MySQL&amp;diff=146423"/>
		<updated>2023-07-13T19:04:37Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Command line */ FLUSH PRIVILEGES implicit when using GRANT https://stackoverflow.com/a/36464093/17436831&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
MySQL is one of the supported databases that underpins a Moodle installation. &lt;br /&gt;
&lt;br /&gt;
== Installing MySQL ==&lt;br /&gt;
&lt;br /&gt;
* If you are running Linux your preference should be to install using your distribution&#039;s package manager. This ensures you will get any available updates.  However, you can also use apt-get or yum depending on the distribution that you are running.&lt;br /&gt;
* There are installers available for most popular operating systems at http://www.mysql.com/downloads/mysql/.&lt;br /&gt;
* It is possible and reasonably straightforward to build mysql from source but it is not recommended (the pre-built binaries are supposedly better optimised).&lt;br /&gt;
* Make sure you set a password for the &#039;root&#039; user (see http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html).&lt;br /&gt;
* Consider installing and configuring my.cnf (the MySQL settings file) to suit your needs. The default configuration is usually very conservative in respect of memory usage versus performance. Increase the &#039;max_allowed_packet&#039; setting to at least 4 megabytes.&lt;br /&gt;
* If you are going to use Master/Slave replication, you must add binlog_format = &#039;ROW&#039; into your my.cnf within [mysqld]. Otherwise, Moodle will not be able to write to the database.&lt;br /&gt;
&lt;br /&gt;
=== Configure full UTF-8 support ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s recommended that full UTF-8 support is configured in MySQL. If this is not done some character sets – notably emojis – cannot be used. It is possible to do this after installing your site but is much easier and quicker before installation.&lt;br /&gt;
&lt;br /&gt;
Check if this is already configured by running the following statement, e.g. at the &#039;&#039;&#039;mysql&amp;gt;&#039;&#039;&#039; prompt or in phpMyAdmin:&lt;br /&gt;
&amp;lt;pre&amp;gt;SHOW GLOBAL VARIABLES WHERE variable_name IN (&#039;innodb_file_format&#039;, &#039;innodb_large_prefix&#039;, &#039;innodb_file_per_table&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:phpMyAdmin1.png|alt=innodb_file_format=Barracuda;innodb_file_per_table=ON;innodb_large_prefix=ON]] or [[File:phpMyAdmin2.png|alt=innodb_file_format=(blank);innodb_file_per_table=ON;innodb_large_prefix=(blank)]] or [[File:phpMyAdmin3.png|alt=innodb_file_per_table=ON]]&lt;br /&gt;
&lt;br /&gt;
If the settings you see match any list above then no changes are needed and you can skip to [[#Creating_Moodle_database| Creating Moodle database]].&lt;br /&gt;
&lt;br /&gt;
If your settings do not match any list you will have to edit the MySQL configuration file. On Linux this may be &#039;&#039;&#039;/etc/my.cnf&#039;&#039;&#039;, &#039;&#039;&#039;/etc/mysql/my.cnf&#039;&#039;&#039;, or &#039;&#039;&#039;/etc/my.cnf.d/mariadb-server.cnf&#039;&#039;&#039;; on Microsoft Windows it may be &#039;&#039;&#039;my.ini&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Note: Back up the configuration file before changing it.&lt;br /&gt;
* Note: Back up all databases before making this change.&lt;br /&gt;
* Note: Other systems with databases on this server may be impacted by this change.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the following settings to the configuration file, do not add &#039;&#039;&#039;innodb_file_format = Barracuda&#039;&#039;&#039; and &#039;&#039;&#039;innodb_large_prefix = 1&#039;&#039;&#039; if these were blank or missing when you ran &#039;&#039;&#039;SHOW GLOBAL VARIABLES&#039;&#039;&#039; above:&lt;br /&gt;
&amp;lt;pre&amp;gt;[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
innodb_file_format = Barracuda   # Remove line if not needed&lt;br /&gt;
innodb_file_per_table = 1&lt;br /&gt;
innodb_large_prefix = 1          # Remove line if not needed&lt;br /&gt;
&lt;br /&gt;
character-set-server = utf8mb4&lt;br /&gt;
collation-server = utf8mb4_unicode_ci&lt;br /&gt;
skip-character-set-client-handshake&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the MySQL server process to apply these settings (for example with MariaDB on Linux: &#039;&#039;&#039;systemctl restart mariadb&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
If you have any difficulty applying these settings, see [[MySQL_full_unicode_support]] for further information.&lt;br /&gt;
&lt;br /&gt;
If for some reason you cannot change to the settings described here you can continue to install Moodle but you must select &#039;&#039;&#039;utf8&#039;&#039;&#039; and &#039;&#039;&#039;utf8_unicode_ci&#039;&#039;&#039; for the default character set and collation respectively.&lt;br /&gt;
&lt;br /&gt;
== Creating Moodle database ==&lt;br /&gt;
&lt;br /&gt;
These are the steps to create an empty Moodle database. Substitute your own database name, user name and password as appropriate.&lt;br /&gt;
&lt;br /&gt;
The instructions assume that the web server and MySQL server are on the same machine. In this case the &#039;dbhost&#039; is &#039;localhost&#039;. If they are on different machines substitute the name of the web server for &#039;localhost&#039; in the following instructions and the &#039;dbhost&#039; setting will be the name of the database server. &lt;br /&gt;
Databases have a &amp;quot;Character set&amp;quot; and a &amp;quot;Collation&amp;quot;. For Moodle, we recommend the Character Set be set to &#039;&#039;&#039;utf8mb4&#039;&#039;&#039; and the Collation &#039;&#039;&#039;utf8mb4_unicode_ci&#039;&#039;&#039;. You may get the option to set these values when you create the database. If you are not given a choice, the default options are probably good. An install on an old server may have the wrong settings.&lt;br /&gt;
&lt;br /&gt;
=== Command line === &lt;br /&gt;
&lt;br /&gt;
* To create a database using the &#039;mysql&#039; command line client, first log into MySQL&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mysql -u root -p&lt;br /&gt;
Enter password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Enter the password you previously set - or been given - for the MySQL &#039;root&#039; user). After some pre-amble this should take you to the &#039;&#039;mysql&amp;gt;&#039;&#039; prompt.&lt;br /&gt;
* Create a new database (called &#039;moodle&#039; - substitute your own name if required).&lt;br /&gt;
If you have successfully configured the recommended full UTF-8 support as described above run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you do not have the recommended full UTF-8 support run:&lt;br /&gt;
&amp;lt;pre&amp;gt;mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Add a user/password with the minimum needed permissions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE USER moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&lt;br /&gt;
mysql&amp;gt; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which creates a user called &#039;moodleuser&#039; with a password &#039;yourpassword&#039;. Make sure you invent a strong password and resist the temptation to &#039;GRANT ALL&#039;.&lt;br /&gt;
* Exit from mysql:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; quit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== phpMyAdmin ===&lt;br /&gt;
&lt;br /&gt;
[http://www.phpmyadmin.net/ phpMyAdmin] is a web based administration tool for MySQL. If this is available you can use it to create a new database. If you have successfully configured the recommended full UTF-8 support as described above select collation &#039;&#039;&#039;utf8mb4_unicode_ci&#039;&#039;&#039;. If you do not have the recommended full UTF-8 support select collation &#039;&#039;&#039;utf8_unicode_ci&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Which database belongs to which Moodle==&lt;br /&gt;
If you have installed several Moodle installations on the same server, there will be several databases in your MySQL server. The names might be quite poor reflections of the content like  _mdl1 _mdl2 _mdl3 . So how do I see which database goes with which Moodle installation? You can go in with phpMyAdmin and in the various databases check for the table &amp;quot;mdl_course&amp;quot;. There you will easily see the name of that Moodle Installation. In table mdl_config you can see the Moodle version. The main URL for the site is not in the database except where there are absolute links.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]]&lt;br /&gt;
* [[MySQL full unicode support]]&lt;br /&gt;
* [http://www.mysql.com/ The MySQL homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/MySQL Wikipedia article about &#039;&#039;MySQL&#039;&#039;]&lt;br /&gt;
* [http://forums.mysql.com/read.php?24,92131,92131 List of articles on MySQL performance tuning]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL databases]]&lt;br /&gt;
&lt;br /&gt;
[[ja:MySQL]]&lt;br /&gt;
[[de:MySQL]]&lt;br /&gt;
[[es:MySQL]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=File:feedbackteacher402.png&amp;diff=146401</id>
		<title>File:feedbackteacher402.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=File:feedbackteacher402.png&amp;diff=146401"/>
		<updated>2023-07-01T13:16:39Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Screenshot of teacher view of feedback activity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Screenshot of teacher view of feedback activity&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=File:feedbackstudent402.png&amp;diff=146400</id>
		<title>File:feedbackstudent402.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=File:feedbackstudent402.png&amp;diff=146400"/>
		<updated>2023-07-01T13:16:05Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Screenshot of student view of feedback activity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Screenshot of student view of feedback activity&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Feedback_activity&amp;diff=146399</id>
		<title>Feedback activity</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Feedback_activity&amp;diff=146399"/>
		<updated>2023-07-01T13:15:42Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* How does it work? */ No preview for students since Moodle 4.1.2 (MDL-70586); update text and screenshots to reflect current appearance&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Activities}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
==What is the Feedback activity?==&lt;br /&gt;
The Feedback activity allows you to create and conduct surveys to collect feedback. Unlike the [[Survey module|Survey]] tool it allows you to write your own questions, rather than choose from a list of pre-written questions and unlike the [[Quiz module|Quiz]] tool, you can create non-graded questions.  The Feedback activity is ideal for course or teacher evaluations.&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/FvtkNJsrwBU | desc = Overview of the Feedback activity}}&lt;br /&gt;
&lt;br /&gt;
==How is it set up?==&lt;br /&gt;
#In a course, with the editing turned on, choose &#039;Feedback&#039; from the activity chooser.&lt;br /&gt;
#Give it a name and if required, a description&lt;br /&gt;
# Expand the other sections to define the settings you want, in particular Question and Submission settings and what to display After submission.&lt;br /&gt;
#Click Save and display and from the Edit questions tab, Add question drop down, add the questions you want.&lt;br /&gt;
==How does it work?==&lt;br /&gt;
&lt;br /&gt;
===Student view===&lt;br /&gt;
Students click on the feedback icon in the course to access the activity and then must click the button &#039;&#039;Answer the questions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:feedbackstudent402.png|alt=Screenshot of student view of feedback with title and answer the questions button]]&lt;br /&gt;
&lt;br /&gt;
===Teacher view===&lt;br /&gt;
Teachers see the &#039;&#039;Settings&#039;&#039; tab as well as an &#039;&#039;Analysis&#039;&#039; tab and &#039;&#039;Responses&#039;&#039; tab. Results may be exported to a spreadsheet program.&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;Analysis&#039;&#039; tab they see a report of the aggregate of responses, including a graphical display of answers to multiple choice questions.&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;Responses&#039;&#039; tab they see individual responses in detail.&lt;br /&gt;
&lt;br /&gt;
[[File:feedbackteacher402.png|alt=Screenshot of teacher view of feedback with tabs Feedback, Settings, Templates, Analysis and Responses, and buttons to edit and preview questions]]&lt;br /&gt;
&lt;br /&gt;
==More information==&lt;br /&gt;
* [[Feedback settings]]&lt;br /&gt;
* [[Building Feedback]]&lt;br /&gt;
* [[Using Feedback]]&lt;br /&gt;
* [[Feedback FAQ]]&lt;br /&gt;
*[[Feedback block]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|If you don&#039;t see the Feedback activity, ask the admin to check it has been  enabled.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Feedback]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Feedback]]&lt;br /&gt;
[[es:Actividad de retroalimentación]]&lt;br /&gt;
[[eu:Feedback]]&lt;br /&gt;
[[de:Feedback]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Talk:Course_settings&amp;diff=146388</id>
		<title>Talk:Course settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Talk:Course_settings&amp;diff=146388"/>
		<updated>2023-06-27T08:34:02Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: #Show_gradebook_to_students suggested update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Locked page==&lt;br /&gt;
&lt;br /&gt;
[[Course settings]] has been locked because previously many people were getting confused and adding their own course full name, short name etc. to the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please use this page for suggesting additional content or other changes...&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Course end date==&lt;br /&gt;
&lt;br /&gt;
Please add&lt;br /&gt;
&lt;br /&gt;
Course end date&lt;br /&gt;
&lt;br /&gt;
Course end date also is used for calculating retention period for deleting data via Privacy API.&lt;br /&gt;
&lt;br /&gt;
: Thanks Ralf, I have added the text as suggested. --[[User:Helen Foster|Helen Foster]] ([[User talk:Helen Foster|talk]]) 08:22, 28 August 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Avoid using non-ASCII characters in course short name==&lt;br /&gt;
Maybe we should have a sentence advising to use only standard ASCII letters and numbers in the short name field, in order  to avoid errors described in https://moodle.org/mod/forum/discuss.php?d=362971#p1537035 and MDL-36652 . [[User:German Valero|German Valero]] ([[User talk:German Valero|talk]])&lt;br /&gt;
&lt;br /&gt;
==Suggested minor update==&lt;br /&gt;
For [[Course_settings#Show_gradebook_to_students]] change to:&lt;br /&gt;
&lt;br /&gt;
Here you can decide whether to allow students to see the link to grades in the &amp;lt;ins&amp;gt;course menu&amp;lt;/ins&amp;gt;. If your course doesn&#039;t use graded activities, it makes sense to disable this. If grades are used and this link is disabled&amp;lt;del&amp;gt;,&amp;lt;/del&amp;gt; students can still see their grade in the actual activity itself, &amp;lt;ins&amp;gt;for example: in an assignment.&amp;lt;/ins&amp;gt;&lt;br /&gt;
--[[User:Leon Stringer|Leon Stringer]] ([[User talk:Leon Stringer|talk]]) 08:33, 27 June 2023 (UTC)&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146355</id>
		<title>Backup and restore FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146355"/>
		<updated>2023-06-12T14:27:40Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: This had been deleted in 2015 (MDL-51972) but crept back in, I don&amp;#039;t think it was ever true (for Moodle 2.0 onwards)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==How do I backup a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course backup]] and [[Automated backup setup]]. &lt;br /&gt;
&lt;br /&gt;
==How do I restore a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course restore]].&lt;br /&gt;
&lt;br /&gt;
==How do I backup my site?==&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]].&lt;br /&gt;
&lt;br /&gt;
==What are the pros and cons of course versus site backups?==&lt;br /&gt;
&lt;br /&gt;
[[Site backup|Site backups]] are recommended in order to have all data saved with the best confidence and the shortest recovery time.&lt;br /&gt;
&lt;br /&gt;
For a site administrator, [[Automated course backup|automated course backups]] are more expensive in terms of time, CPU usage and storage. The recovery time to have a site running again takes longer than a site backup. However, teachers and site administrators might find a course backups as a way to create a &amp;quot;fresh&amp;quot; copy of a course that can be re-used (in older versions of Moodle, in newer versions see [[Import course data]]) or as a method to distribute a course(s) to other Moodle sites.&lt;br /&gt;
&lt;br /&gt;
==What data is not contained in course backups?==&lt;br /&gt;
&lt;br /&gt;
By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:&lt;br /&gt;
* Quiz questions are only backed up if at least one question from their category has been added to a quiz.&lt;br /&gt;
* Scales are only backed up if they are used by at least one activity.&lt;br /&gt;
* Users&#039; passwords are not backed up when the &amp;quot;Include enrolled users&amp;quot; option is selected.&lt;br /&gt;
* Glossary data&lt;br /&gt;
* Badges - if they have not been awarded to at least one user and users are not included in the course backup.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student log and participation data?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include logs.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user activities can be saved as the option &amp;quot;Include course logs&amp;quot; will now appear on the backup menu of items to include in the backup. These logs provide the data that the various reports such as Course participation, Logs, and Activity report, use to produce their reports.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student grade history?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include histories.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user grade history and its changes made by teachers manually or by certain activities can be saved when performing a Backup. The option &amp;quot;Include grade history&amp;quot; will now appear on the backup menu of items to include in the backup.&lt;br /&gt;
&lt;br /&gt;
==What do the backup file names mean?==&lt;br /&gt;
&lt;br /&gt;
The default backup file name is composed of the following parts:&lt;br /&gt;
&lt;br /&gt;
*backup-moodle2-  :: This tells you that it is backup file of version 2 backup, which have been used since Moodle 2.0, and so it not a Moodle 1 backup file&lt;br /&gt;
*course-##-  ::  This tells you it is a course backup and the ## is the internal id number of the course, as seen in the course url&lt;br /&gt;
*shortname-  :: Then follows the shortname of the course as set in the course settings&lt;br /&gt;
*date-time-  ::  This is the date and time in ISO format when the backup was made&lt;br /&gt;
* nu-nf  ::  optional suffixes: If the backup does not contain enrolled users, the -nu will be added; if the backup does not include files, the -nf will be added&lt;br /&gt;
*.mbz  :: The file extension stands for &amp;quot;Moodle backup zip&amp;quot; and you can rename to .zip or .gzip (depending on your server OS) to expand it&lt;br /&gt;
&lt;br /&gt;
Example: backup-moodle2-course-27-HISTORY101-20210124-0916-nu-nf.mbz&lt;br /&gt;
&lt;br /&gt;
Deciphered: This is a backup file from Moodle 2 or above of course with id 27 with shortname HISTORY-101 made on Jan 24, 2021 at 09:16 AM with no enrolled users and no files included in it.&lt;br /&gt;
&lt;br /&gt;
==How can I backup or restore a very large course?==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;Error: An error occurred deleting old backup data&amp;quot;. What should I do?==&lt;br /&gt;
&lt;br /&gt;
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Delete old records from &amp;quot;backup_ids&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old records from &amp;quot;backup_files&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old files from &amp;quot;moodledata/temp/backup&amp;quot;: Delete the dir completely and try again.&lt;br /&gt;
&lt;br /&gt;
[[Image:BackupProblem.gif|thumb|Backup error message]]&lt;br /&gt;
For points 1 &amp;amp; 2, there are various ways of repairing tables, including using MySQL Admin.&lt;br /&gt;
&lt;br /&gt;
For point 3 see below:&lt;br /&gt;
&lt;br /&gt;
The error message states that the &amp;quot;directory not empty&amp;quot; and gives the path to that directory. If you go there with an FTP program you can see what is there and clean up. It could be just some empty subfolders that were leftover. Deleting these has been able to help. One can also delete the dir &amp;quot;moodledata/temp/backup&amp;quot; completely. That can take a bit longer but may solve several problems at once.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;XML error: not well-formed (invalid token) at line YYYY&amp;quot;. What can I do?==&lt;br /&gt;
&lt;br /&gt;
This problem can appear at any point in the restore process. It&#039;s caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it&#039;s caused by some &amp;quot;illegal&amp;quot; characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).&lt;br /&gt;
&lt;br /&gt;
The best method to handle this issue is:&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic backup file under one empty folder.&lt;br /&gt;
&lt;br /&gt;
* Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.&lt;br /&gt;
&lt;br /&gt;
* Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.&lt;br /&gt;
&lt;br /&gt;
* Test the moodle.xml file again with Firefox until no error was displayed.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but not the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
* Restore still not working? See the next question.&lt;br /&gt;
&lt;br /&gt;
Also, if possible, it&#039;s highly recommended to solve those problems in the original course too from Moodle itself. Once &amp;quot;repaired&amp;quot; there, problems will be out if you create new backup files in the future.&lt;br /&gt;
&lt;br /&gt;
==I Still get an XML error. How can I clean the borked XML file?==&lt;br /&gt;
&lt;br /&gt;
In some cases XML backup files may contain characters causing the restore process to abort, even after the steps described in the previous question. In such cases you may want to try the following:&lt;br /&gt;
&lt;br /&gt;
* Download the [https://confluence.atlassian.com/jira/files/12079/atlassian-xml-cleaner-0.1.jar Atlassian XML Cleaner Utility] from the [http://confluence.atlassian.com/display/JIRA/Removing+invalid+characters+from+XML+backups JIRA Atlassian site].&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic Moodle backup file under one empty folder. Moodle will create the course file folders as long as the unclean moodle.xml file. Please unzip using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Rename the unclean moodle.xml file to moodle-unclean.xml.&lt;br /&gt;
&lt;br /&gt;
* If you don&#039;t have access to your Moodle server&#039;s command prompt, using the Moodle zip feature, zip the moodle-unclean.xml file only, download the zip file locally and unzip it. It is very important to download the xml file in zipped format to avoid unwanted character encoding when transferring from an operating system to another.&lt;br /&gt;
&lt;br /&gt;
* Move the downloaded Atlassian XML Cleaner Utility in the same folder where is your moodle-unclean.xml file.&lt;br /&gt;
&lt;br /&gt;
* Issue the following command from the command prompt: &lt;br /&gt;
&lt;br /&gt;
 java -jar atlassian-xml-cleaner-0.1.jar moodle-unclean.xml &amp;gt; moodle.xml&lt;br /&gt;
&lt;br /&gt;
* If you launched the utility on your local computer, zip the just created (and hopefully cleaned) moodle.xml file and upload it in the same place from where you downloaded the moodle-unclean.xml file. Once uploaded, unzip it using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;Some of your courses weren&#039;t saved!!&amp;quot; mean?==&lt;br /&gt;
&lt;br /&gt;
There are three possible causes of this problem:&lt;br /&gt;
# Error - this happens when the backup procedure has found an error and so hasn&#039;t finished the backup of a particular course. These are &amp;quot;controlled&amp;quot; errors and the scheduled backup continues with the next course.&lt;br /&gt;
# Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the &amp;quot;crash&amp;quot; is happening at exact time intervals (usually a problem with the max_execution_time php&#039;s variable), or if there is some exact point were all the courses are breaking.&lt;br /&gt;
# Skipped - this happens when a course is unavailable to students and has not been changed in the last month (31 days). This isn&#039;t an error situation - it&#039;s a feature, especially useful for sites with many unavailable old courses, saving process time.&lt;br /&gt;
&lt;br /&gt;
==Why are some courses being skipped?==&lt;br /&gt;
&lt;br /&gt;
[[Image:autobackup_skip_settings.png|thumb|AutoBackup &#039;&#039;&#039;skip&#039;&#039;&#039; settings]]Moodle&#039;s &#039;&#039;Course backups&#039;&#039; routines are instructed to automatically skip courses based on three settings in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; Automated backup setup.&#039;&#039; The Moodle administrator(s) use those settings to specify whether to &#039;&#039;Skip hidden courses&#039;&#039; (set by default to &#039;Yes&#039;), &#039;&#039;Skip courses not modified since&#039;&#039; (set by default to &#039;30 days&#039;), and &#039;&#039;Skip courses not modified since previous backup&#039;&#039; (set by default to &#039;No&#039;). A course which meets any of the enabled criteria will be skipped during the next run of &#039;&#039;Course backups&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Why does restore stop, rather than completing?==&lt;br /&gt;
&lt;br /&gt;
Attempting to restore a course to an older version of Moodle than the one the course was backed up on can result in the restore process failing to complete. To ensure a successful restore, make sure that the version of Moodle you are restoring the course to is the same, or newer, than the one the course was backed up on.&lt;br /&gt;
&lt;br /&gt;
If it stop unexpectedly with no errors shown try again with [[Debugging]] switched on. Any errors you now see can help experts in the support forums diagnose your problem. You can also check the discussion links in the See also section below for further advice.&lt;br /&gt;
&lt;br /&gt;
==Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This message is displayed when:&lt;br /&gt;
&lt;br /&gt;
# The target site has a user xxxx (xxxx being the username) - often the admin user&lt;br /&gt;
# The backup archive being restored also contains a user xxxx (same username)&lt;br /&gt;
# After various comparisons, Moodle has determined that the target site user xxxx and the backup user xxxx aren&#039;t the same person, for example: if these users have different email addresses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 1, 2 and 3 are all true, the restore process stops in order to prevent the backup user xxxx&#039;s activities (forum posts, quiz attempts, assignment uploads, etc.) from being associated with the target site user xxxx. &lt;br /&gt;
&lt;br /&gt;
Here are the possible methods to make the xxxx users match and resolve the conflict:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the backup archive&#039;s &#039;&#039;&#039;users.xml&#039;&#039;&#039; file and make the &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields match the ones in target site. Note that the &#039;&#039;&#039;&#039;&#039;backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039; is a [https://en.wikipedia.org/wiki/Tar_(computing) tarball] and can be extracted by creating a temporary folder and running &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. When editing is complete recompress the file with &#039;&#039;&#039;tar -czf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz *&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the target site and set the user &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields to match the ones in &#039;&#039;&#039;users.xml&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;For admin user conflicts only: enable the setting &#039;Allow admin conflict resolution&#039; in &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General import defaults&#039;&#039;. This will result in the username in the backup file being renamed to &#039;admin_xyz&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Restored users lose their passwords - How can they reset them?==&lt;br /&gt;
&lt;br /&gt;
When a course is restored with enroled users included, any new users not already in the system will have new accounts created for them. Backups with enroled users do not include the user passwords. Instead, a password of &amp;quot;restored&amp;quot; is placed in the database for such users. When the user attempts to log into the new site, Moodle will recognise they were restored from a course backup and give the user the following message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Restored Account. &lt;br /&gt;
This account was imported from another server and the password has been lost. To set a new password by email, please click &amp;quot;Continue&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the &amp;quot;Continue&amp;quot; button, they will then be sent a change password email to the email address associated with the restored account, just as if they had used the normal &amp;quot;Forgotten password&amp;quot; process. This will allow them to set a new password.&lt;br /&gt;
&lt;br /&gt;
If you are the administrator and wish to avoid users getting such emails, remember that you can use the [[Upload users|Upload users tool]] to bulk set new passwords.&lt;br /&gt;
&lt;br /&gt;
==Why are certain course links broken in a restored course?==&lt;br /&gt;
&lt;br /&gt;
Inter-activity links must be absolute (full) URLs e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://site.com/mod/resource/view.php?id=xxx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in order to be processed properly during backup and restore.&lt;br /&gt;
&lt;br /&gt;
Any relative URLs e.g. &amp;lt;code&amp;gt;/mod/resource/view.php?id=xxx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;../resource/view.php?id=xxx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;view.php?id=xxx&amp;lt;/code&amp;gt; will result in broken links when the course is restored.&lt;br /&gt;
&lt;br /&gt;
==Restoring a course results in broken HTML tags. What can I do?==&lt;br /&gt;
This has been known to be caused by older versions of   libxml2 and PHP  - try updating them to the latest versions.&lt;br /&gt;
&lt;br /&gt;
==How can I extract original files from a Moodle backup file?==&lt;br /&gt;
If you really want to get original files from the backup file (an .mbz file) you downloaded (from the course&#039;s restore page), you can do so in much the same way as is suggested above. &lt;br /&gt;
&lt;br /&gt;
The backup file can be opened with the command &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. Create a temporary folder to extract the backup&#039;s files into.&lt;br /&gt;
&lt;br /&gt;
Next step would be to open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file in a text editor, and:&lt;br /&gt;
&lt;br /&gt;
# Search for the name of each file you want to get.&lt;br /&gt;
# Take note of the value of the corresponding contenthash tag.&lt;br /&gt;
# In the &#039;&#039;&#039;files&#039;&#039;&#039; folder you extracted, locate the file whose name is the same as the value of the contenthash and which will be located in a folder whose name corresponds to the two first characters of the file name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s assume there is a &#039;&#039;&#039;backup_courses-120730.mbz&#039;&#039;&#039; file of which the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and the &#039;&#039;&#039;files&#039;&#039;&#039; folder have been extracted. There is a PDF file named &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; that is required for another purpose.&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and:&lt;br /&gt;
&lt;br /&gt;
1. Search for the string &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039;, which in this case is found under the following &amp;amp;lt;file id...&amp;amp;gt; group tag:&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;file id=&amp;quot;12345&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;contenthash&amp;amp;gt;fb6cf43a9b2d432403c70a2cb4c340dbb6225631&amp;amp;lt;/contenthash&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;filename&amp;amp;gt;Leadership.pdf&amp;amp;lt;/filename&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;license&amp;amp;gt;allrightsreserved&amp;amp;lt;/license&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;sortorder&amp;amp;gt;1&amp;amp;lt;/sortorder&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/file&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Take note of the corresponding contenthash value: fb6cf43a9b2d432403c70a2cb4c340dbb6225631.&lt;br /&gt;
&lt;br /&gt;
3. As the first two characters of the contenthash are &amp;quot;fb&amp;quot;, open the &#039;&#039;&#039;fb&#039;&#039;&#039; subfolder inside the &#039;&#039;&#039;files&#039;&#039;&#039; folder, and there is a file named &#039;&#039;&#039;fb6cf43a9b...&#039;&#039;&#039;. Rename that file as &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; and move it to the desired location. Repeat this for all the files required, using the corresponding contenthash value each time.&lt;br /&gt;
&lt;br /&gt;
==MySQL dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=128 Backup and restore forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Moodle migration]]&lt;br /&gt;
&lt;br /&gt;
Moodle forum discussions:&lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=345466 Backing up and restoring course eliminates gradebook categories and items]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Respaldo y restauración FAQ]]&lt;br /&gt;
[[pl:Backup FAQ]]&lt;br /&gt;
[[fr:FAQ de sauvegarde]]&lt;br /&gt;
[[ja:バックアップFAQ]]&lt;br /&gt;
[[pt:FAQ sobre cópias de segurança]]&lt;br /&gt;
[[de:Sicherung und Wiederherstellung FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146312</id>
		<title>Backup and restore FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146312"/>
		<updated>2023-06-12T08:08:50Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot; */ Specific example added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==How do I backup a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course backup]] and [[Automated backup setup]]. &lt;br /&gt;
&lt;br /&gt;
==How do I restore a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course restore]].&lt;br /&gt;
&lt;br /&gt;
==How do I backup my site?==&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]].&lt;br /&gt;
&lt;br /&gt;
==What are the pros and cons of course versus site backups?==&lt;br /&gt;
&lt;br /&gt;
[[Site backup|Site backups]] are recommended in order to have all data saved with the best confidence and the shortest recovery time.&lt;br /&gt;
&lt;br /&gt;
For a site administrator, [[Automated course backup|automated course backups]] are more expensive in terms of time, CPU usage and storage. The recovery time to have a site running again takes longer than a site backup. However, teachers and site administrators might find a course backups as a way to create a &amp;quot;fresh&amp;quot; copy of a course that can be re-used (in older versions of Moodle, in newer versions see [[Import course data]]) or as a method to distribute a course(s) to other Moodle sites.&lt;br /&gt;
&lt;br /&gt;
==Why is my automated course backup much smaller in size than my manual course backup?==&lt;br /&gt;
&lt;br /&gt;
This is an intentional design decision. Because of the way files are stored in Moodle 2.x, there is no need to include the files in the backup if you are planning to restore them to the same Moodle site. Leaving them out saves huge amounts of disk space and makes the backup procedure much faster. &lt;br /&gt;
&lt;br /&gt;
==What data is not contained in course backups?==&lt;br /&gt;
&lt;br /&gt;
By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:&lt;br /&gt;
* Quiz questions are only backed up if at least one question from their category has been added to a quiz.&lt;br /&gt;
* Scales are only backed up if they are used by at least one activity.&lt;br /&gt;
* Users&#039; passwords are not backed up when the &amp;quot;Include enrolled users&amp;quot; option is selected.&lt;br /&gt;
* Glossary data&lt;br /&gt;
* Badges - if they have not been awarded to at least one user and users are not included in the course backup.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student log and participation data?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include logs.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user activities can be saved as the option &amp;quot;Include course logs&amp;quot; will now appear on the backup menu of items to include in the backup. These logs provide the data that the various reports such as Course participation, Logs, and Activity report, use to produce their reports.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student grade history?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include histories.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user grade history and its changes made by teachers manually or by certain activities can be saved when performing a Backup. The option &amp;quot;Include grade history&amp;quot; will now appear on the backup menu of items to include in the backup.&lt;br /&gt;
&lt;br /&gt;
==What do the backup file names mean?==&lt;br /&gt;
&lt;br /&gt;
The default backup file name is composed of the following parts:&lt;br /&gt;
&lt;br /&gt;
*backup-moodle2-  :: This tells you that it is backup file of version 2 backup, which have been used since Moodle 2.0, and so it not a Moodle 1 backup file&lt;br /&gt;
*course-##-  ::  This tells you it is a course backup and the ## is the internal id number of the course, as seen in the course url&lt;br /&gt;
*shortname-  :: Then follows the shortname of the course as set in the course settings&lt;br /&gt;
*date-time-  ::  This is the date and time in ISO format when the backup was made&lt;br /&gt;
* nu-nf  ::  optional suffixes: If the backup does not contain enrolled users, the -nu will be added; if the backup does not include files, the -nf will be added&lt;br /&gt;
*.mbz  :: The file extension stands for &amp;quot;Moodle backup zip&amp;quot; and you can rename to .zip or .gzip (depending on your server OS) to expand it&lt;br /&gt;
&lt;br /&gt;
Example: backup-moodle2-course-27-HISTORY101-20210124-0916-nu-nf.mbz&lt;br /&gt;
&lt;br /&gt;
Deciphered: This is a backup file from Moodle 2 or above of course with id 27 with shortname HISTORY-101 made on Jan 24, 2021 at 09:16 AM with no enrolled users and no files included in it.&lt;br /&gt;
&lt;br /&gt;
==How can I backup or restore a very large course?==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;Error: An error occurred deleting old backup data&amp;quot;. What should I do?==&lt;br /&gt;
&lt;br /&gt;
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Delete old records from &amp;quot;backup_ids&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old records from &amp;quot;backup_files&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old files from &amp;quot;moodledata/temp/backup&amp;quot;: Delete the dir completely and try again.&lt;br /&gt;
&lt;br /&gt;
[[Image:BackupProblem.gif|thumb|Backup error message]]&lt;br /&gt;
For points 1 &amp;amp; 2, there are various ways of repairing tables, including using MySQL Admin.&lt;br /&gt;
&lt;br /&gt;
For point 3 see below:&lt;br /&gt;
&lt;br /&gt;
The error message states that the &amp;quot;directory not empty&amp;quot; and gives the path to that directory. If you go there with an FTP program you can see what is there and clean up. It could be just some empty subfolders that were leftover. Deleting these has been able to help. One can also delete the dir &amp;quot;moodledata/temp/backup&amp;quot; completely. That can take a bit longer but may solve several problems at once.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;XML error: not well-formed (invalid token) at line YYYY&amp;quot;. What can I do?==&lt;br /&gt;
&lt;br /&gt;
This problem can appear at any point in the restore process. It&#039;s caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it&#039;s caused by some &amp;quot;illegal&amp;quot; characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).&lt;br /&gt;
&lt;br /&gt;
The best method to handle this issue is:&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic backup file under one empty folder.&lt;br /&gt;
&lt;br /&gt;
* Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.&lt;br /&gt;
&lt;br /&gt;
* Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.&lt;br /&gt;
&lt;br /&gt;
* Test the moodle.xml file again with Firefox until no error was displayed.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but not the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
* Restore still not working? See the next question.&lt;br /&gt;
&lt;br /&gt;
Also, if possible, it&#039;s highly recommended to solve those problems in the original course too from Moodle itself. Once &amp;quot;repaired&amp;quot; there, problems will be out if you create new backup files in the future.&lt;br /&gt;
&lt;br /&gt;
==I Still get an XML error. How can I clean the borked XML file?==&lt;br /&gt;
&lt;br /&gt;
In some cases XML backup files may contain characters causing the restore process to abort, even after the steps described in the previous question. In such cases you may want to try the following:&lt;br /&gt;
&lt;br /&gt;
* Download the [https://confluence.atlassian.com/jira/files/12079/atlassian-xml-cleaner-0.1.jar Atlassian XML Cleaner Utility] from the [http://confluence.atlassian.com/display/JIRA/Removing+invalid+characters+from+XML+backups JIRA Atlassian site].&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic Moodle backup file under one empty folder. Moodle will create the course file folders as long as the unclean moodle.xml file. Please unzip using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Rename the unclean moodle.xml file to moodle-unclean.xml.&lt;br /&gt;
&lt;br /&gt;
* If you don&#039;t have access to your Moodle server&#039;s command prompt, using the Moodle zip feature, zip the moodle-unclean.xml file only, download the zip file locally and unzip it. It is very important to download the xml file in zipped format to avoid unwanted character encoding when transferring from an operating system to another.&lt;br /&gt;
&lt;br /&gt;
* Move the downloaded Atlassian XML Cleaner Utility in the same folder where is your moodle-unclean.xml file.&lt;br /&gt;
&lt;br /&gt;
* Issue the following command from the command prompt: &lt;br /&gt;
&lt;br /&gt;
 java -jar atlassian-xml-cleaner-0.1.jar moodle-unclean.xml &amp;gt; moodle.xml&lt;br /&gt;
&lt;br /&gt;
* If you launched the utility on your local computer, zip the just created (and hopefully cleaned) moodle.xml file and upload it in the same place from where you downloaded the moodle-unclean.xml file. Once uploaded, unzip it using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;Some of your courses weren&#039;t saved!!&amp;quot; mean?==&lt;br /&gt;
&lt;br /&gt;
There are three possible causes of this problem:&lt;br /&gt;
# Error - this happens when the backup procedure has found an error and so hasn&#039;t finished the backup of a particular course. These are &amp;quot;controlled&amp;quot; errors and the scheduled backup continues with the next course.&lt;br /&gt;
# Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the &amp;quot;crash&amp;quot; is happening at exact time intervals (usually a problem with the max_execution_time php&#039;s variable), or if there is some exact point were all the courses are breaking.&lt;br /&gt;
# Skipped - this happens when a course is unavailable to students and has not been changed in the last month (31 days). This isn&#039;t an error situation - it&#039;s a feature, especially useful for sites with many unavailable old courses, saving process time.&lt;br /&gt;
&lt;br /&gt;
==Why are some courses being skipped?==&lt;br /&gt;
&lt;br /&gt;
[[Image:autobackup_skip_settings.png|thumb|AutoBackup &#039;&#039;&#039;skip&#039;&#039;&#039; settings]]Moodle&#039;s &#039;&#039;Course backups&#039;&#039; routines are instructed to automatically skip courses based on three settings in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; Automated backup setup.&#039;&#039; The Moodle administrator(s) use those settings to specify whether to &#039;&#039;Skip hidden courses&#039;&#039; (set by default to &#039;Yes&#039;), &#039;&#039;Skip courses not modified since&#039;&#039; (set by default to &#039;30 days&#039;), and &#039;&#039;Skip courses not modified since previous backup&#039;&#039; (set by default to &#039;No&#039;). A course which meets any of the enabled criteria will be skipped during the next run of &#039;&#039;Course backups&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Why does restore stop, rather than completing?==&lt;br /&gt;
&lt;br /&gt;
Attempting to restore a course to an older version of Moodle than the one the course was backed up on can result in the restore process failing to complete. To ensure a successful restore, make sure that the version of Moodle you are restoring the course to is the same, or newer, than the one the course was backed up on.&lt;br /&gt;
&lt;br /&gt;
If it stop unexpectedly with no errors shown try again with [[Debugging]] switched on. Any errors you now see can help experts in the support forums diagnose your problem. You can also check the discussion links in the See also section below for further advice.&lt;br /&gt;
&lt;br /&gt;
==Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This message is displayed when:&lt;br /&gt;
&lt;br /&gt;
# The target site has a user xxxx (xxxx being the username) - often the admin user&lt;br /&gt;
# The backup archive being restored also contains a user xxxx (same username)&lt;br /&gt;
# After various comparisons, Moodle has determined that the target site user xxxx and the backup user xxxx aren&#039;t the same person, for example: if these users have different email addresses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 1, 2 and 3 are all true, the restore process stops in order to prevent the backup user xxxx&#039;s activities (forum posts, quiz attempts, assignment uploads, etc.) from being associated with the target site user xxxx. &lt;br /&gt;
&lt;br /&gt;
Here are the possible methods to make the xxxx users match and resolve the conflict:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the backup archive&#039;s &#039;&#039;&#039;users.xml&#039;&#039;&#039; file and make the &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields match the ones in target site. Note that the &#039;&#039;&#039;&#039;&#039;backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039; is a [https://en.wikipedia.org/wiki/Tar_(computing) tarball] and can be extracted by creating a temporary folder and running &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. When editing is complete recompress the file with &#039;&#039;&#039;tar -czf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz *&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the target site and set the user &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields to match the ones in &#039;&#039;&#039;users.xml&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;For admin user conflicts only: enable the setting &#039;Allow admin conflict resolution&#039; in &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General import defaults&#039;&#039;. This will result in the username in the backup file being renamed to &#039;admin_xyz&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Restored users lose their passwords - How can they reset them?==&lt;br /&gt;
&lt;br /&gt;
When a course is restored with enroled users included, any new users not already in the system will have new accounts created for them. Backups with enroled users do not include the user passwords. Instead, a password of &amp;quot;restored&amp;quot; is placed in the database for such users. When the user attempts to log into the new site, Moodle will recognise they were restored from a course backup and give the user the following message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Restored Account. &lt;br /&gt;
This account was imported from another server and the password has been lost. To set a new password by email, please click &amp;quot;Continue&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the &amp;quot;Continue&amp;quot; button, they will then be sent a change password email to the email address associated with the restored account, just as if they had used the normal &amp;quot;Forgotten password&amp;quot; process. This will allow them to set a new password.&lt;br /&gt;
&lt;br /&gt;
If you are the administrator and wish to avoid users getting such emails, remember that you can use the [[Upload users|Upload users tool]] to bulk set new passwords.&lt;br /&gt;
&lt;br /&gt;
==Why are certain course links broken in a restored course?==&lt;br /&gt;
&lt;br /&gt;
Inter-activity links must be absolute (full) URLs e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://site.com/mod/resource/view.php?id=xxx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in order to be processed properly during backup and restore.&lt;br /&gt;
&lt;br /&gt;
Any relative URLs e.g. &amp;lt;code&amp;gt;/mod/resource/view.php?id=xxx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;../resource/view.php?id=xxx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;view.php?id=xxx&amp;lt;/code&amp;gt; will result in broken links when the course is restored.&lt;br /&gt;
&lt;br /&gt;
==Restoring a course results in broken HTML tags. What can I do?==&lt;br /&gt;
This has been known to be caused by older versions of   libxml2 and PHP  - try updating them to the latest versions.&lt;br /&gt;
&lt;br /&gt;
==How can I extract original files from a Moodle backup file?==&lt;br /&gt;
If you really want to get original files from the backup file (an .mbz file) you downloaded (from the course&#039;s restore page), you can do so in much the same way as is suggested above. &lt;br /&gt;
&lt;br /&gt;
The backup file can be opened with the command &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. Create a temporary folder to extract the backup&#039;s files into.&lt;br /&gt;
&lt;br /&gt;
Next step would be to open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file in a text editor, and:&lt;br /&gt;
&lt;br /&gt;
# Search for the name of each file you want to get.&lt;br /&gt;
# Take note of the value of the corresponding contenthash tag.&lt;br /&gt;
# In the &#039;&#039;&#039;files&#039;&#039;&#039; folder you extracted, locate the file whose name is the same as the value of the contenthash and which will be located in a folder whose name corresponds to the two first characters of the file name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s assume there is a &#039;&#039;&#039;backup_courses-120730.mbz&#039;&#039;&#039; file of which the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and the &#039;&#039;&#039;files&#039;&#039;&#039; folder have been extracted. There is a PDF file named &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; that is required for another purpose.&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and:&lt;br /&gt;
&lt;br /&gt;
1. Search for the string &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039;, which in this case is found under the following &amp;amp;lt;file id...&amp;amp;gt; group tag:&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;file id=&amp;quot;12345&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;contenthash&amp;amp;gt;fb6cf43a9b2d432403c70a2cb4c340dbb6225631&amp;amp;lt;/contenthash&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;filename&amp;amp;gt;Leadership.pdf&amp;amp;lt;/filename&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;license&amp;amp;gt;allrightsreserved&amp;amp;lt;/license&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;sortorder&amp;amp;gt;1&amp;amp;lt;/sortorder&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/file&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Take note of the corresponding contenthash value: fb6cf43a9b2d432403c70a2cb4c340dbb6225631.&lt;br /&gt;
&lt;br /&gt;
3. As the first two characters of the contenthash are &amp;quot;fb&amp;quot;, open the &#039;&#039;&#039;fb&#039;&#039;&#039; subfolder inside the &#039;&#039;&#039;files&#039;&#039;&#039; folder, and there is a file named &#039;&#039;&#039;fb6cf43a9b...&#039;&#039;&#039;. Rename that file as &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; and move it to the desired location. Repeat this for all the files required, using the corresponding contenthash value each time.&lt;br /&gt;
&lt;br /&gt;
==MySQL dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=128 Backup and restore forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Moodle migration]]&lt;br /&gt;
&lt;br /&gt;
Moodle forum discussions:&lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=345466 Backing up and restoring course eliminates gradebook categories and items]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Respaldo y restauración FAQ]]&lt;br /&gt;
[[pl:Backup FAQ]]&lt;br /&gt;
[[fr:FAQ de sauvegarde]]&lt;br /&gt;
[[ja:バックアップFAQ]]&lt;br /&gt;
[[pt:FAQ sobre cópias de segurança]]&lt;br /&gt;
[[de:Sicherung und Wiederherstellung FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146303</id>
		<title>Backup and restore FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146303"/>
		<updated>2023-06-10T15:19:48Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* How can I extract original files from a Moodle backup file? */ MBZ files are tarballs not zips since MDL-49298/Moodle 2.9 (should fix MDLSITE-5140)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==How do I backup a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course backup]] and [[Automated backup setup]]. &lt;br /&gt;
&lt;br /&gt;
==How do I restore a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course restore]].&lt;br /&gt;
&lt;br /&gt;
==How do I backup my site?==&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]].&lt;br /&gt;
&lt;br /&gt;
==What are the pros and cons of course versus site backups?==&lt;br /&gt;
&lt;br /&gt;
[[Site backup|Site backups]] are recommended in order to have all data saved with the best confidence and the shortest recovery time.&lt;br /&gt;
&lt;br /&gt;
For a site administrator, [[Automated course backup|automated course backups]] are more expensive in terms of time, CPU usage and storage. The recovery time to have a site running again takes longer than a site backup. However, teachers and site administrators might find a course backups as a way to create a &amp;quot;fresh&amp;quot; copy of a course that can be re-used (in older versions of Moodle, in newer versions see [[Import course data]]) or as a method to distribute a course(s) to other Moodle sites.&lt;br /&gt;
&lt;br /&gt;
==Why is my automated course backup much smaller in size than my manual course backup?==&lt;br /&gt;
&lt;br /&gt;
This is an intentional design decision. Because of the way files are stored in Moodle 2.x, there is no need to include the files in the backup if you are planning to restore them to the same Moodle site. Leaving them out saves huge amounts of disk space and makes the backup procedure much faster. &lt;br /&gt;
&lt;br /&gt;
==What data is not contained in course backups?==&lt;br /&gt;
&lt;br /&gt;
By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:&lt;br /&gt;
* Quiz questions are only backed up if at least one question from their category has been added to a quiz.&lt;br /&gt;
* Scales are only backed up if they are used by at least one activity.&lt;br /&gt;
* Users&#039; passwords are not backed up when the &amp;quot;Include enrolled users&amp;quot; option is selected.&lt;br /&gt;
* Glossary data&lt;br /&gt;
* Badges - if they have not been awarded to at least one user and users are not included in the course backup.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student log and participation data?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include logs.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user activities can be saved as the option &amp;quot;Include course logs&amp;quot; will now appear on the backup menu of items to include in the backup. These logs provide the data that the various reports such as Course participation, Logs, and Activity report, use to produce their reports.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student grade history?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include histories.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user grade history and its changes made by teachers manually or by certain activities can be saved when performing a Backup. The option &amp;quot;Include grade history&amp;quot; will now appear on the backup menu of items to include in the backup.&lt;br /&gt;
&lt;br /&gt;
==What do the backup file names mean?==&lt;br /&gt;
&lt;br /&gt;
The default backup file name is composed of the following parts:&lt;br /&gt;
&lt;br /&gt;
*backup-moodle2-  :: This tells you that it is backup file of version 2 backup, which have been used since Moodle 2.0, and so it not a Moodle 1 backup file&lt;br /&gt;
*course-##-  ::  This tells you it is a course backup and the ## is the internal id number of the course, as seen in the course url&lt;br /&gt;
*shortname-  :: Then follows the shortname of the course as set in the course settings&lt;br /&gt;
*date-time-  ::  This is the date and time in ISO format when the backup was made&lt;br /&gt;
* nu-nf  ::  optional suffixes: If the backup does not contain enrolled users, the -nu will be added; if the backup does not include files, the -nf will be added&lt;br /&gt;
*.mbz  :: The file extension stands for &amp;quot;Moodle backup zip&amp;quot; and you can rename to .zip or .gzip (depending on your server OS) to expand it&lt;br /&gt;
&lt;br /&gt;
Example: backup-moodle2-course-27-HISTORY101-20210124-0916-nu-nf.mbz&lt;br /&gt;
&lt;br /&gt;
Deciphered: This is a backup file from Moodle 2 or above of course with id 27 with shortname HISTORY-101 made on Jan 24, 2021 at 09:16 AM with no enrolled users and no files included in it.&lt;br /&gt;
&lt;br /&gt;
==How can I backup or restore a very large course?==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;Error: An error occurred deleting old backup data&amp;quot;. What should I do?==&lt;br /&gt;
&lt;br /&gt;
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Delete old records from &amp;quot;backup_ids&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old records from &amp;quot;backup_files&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old files from &amp;quot;moodledata/temp/backup&amp;quot;: Delete the dir completely and try again.&lt;br /&gt;
&lt;br /&gt;
[[Image:BackupProblem.gif|thumb|Backup error message]]&lt;br /&gt;
For points 1 &amp;amp; 2, there are various ways of repairing tables, including using MySQL Admin.&lt;br /&gt;
&lt;br /&gt;
For point 3 see below:&lt;br /&gt;
&lt;br /&gt;
The error message states that the &amp;quot;directory not empty&amp;quot; and gives the path to that directory. If you go there with an FTP program you can see what is there and clean up. It could be just some empty subfolders that were leftover. Deleting these has been able to help. One can also delete the dir &amp;quot;moodledata/temp/backup&amp;quot; completely. That can take a bit longer but may solve several problems at once.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;XML error: not well-formed (invalid token) at line YYYY&amp;quot;. What can I do?==&lt;br /&gt;
&lt;br /&gt;
This problem can appear at any point in the restore process. It&#039;s caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it&#039;s caused by some &amp;quot;illegal&amp;quot; characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).&lt;br /&gt;
&lt;br /&gt;
The best method to handle this issue is:&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic backup file under one empty folder.&lt;br /&gt;
&lt;br /&gt;
* Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.&lt;br /&gt;
&lt;br /&gt;
* Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.&lt;br /&gt;
&lt;br /&gt;
* Test the moodle.xml file again with Firefox until no error was displayed.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but not the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
* Restore still not working? See the next question.&lt;br /&gt;
&lt;br /&gt;
Also, if possible, it&#039;s highly recommended to solve those problems in the original course too from Moodle itself. Once &amp;quot;repaired&amp;quot; there, problems will be out if you create new backup files in the future.&lt;br /&gt;
&lt;br /&gt;
==I Still get an XML error. How can I clean the borked XML file?==&lt;br /&gt;
&lt;br /&gt;
In some cases XML backup files may contain characters causing the restore process to abort, even after the steps described in the previous question. In such cases you may want to try the following:&lt;br /&gt;
&lt;br /&gt;
* Download the [https://confluence.atlassian.com/jira/files/12079/atlassian-xml-cleaner-0.1.jar Atlassian XML Cleaner Utility] from the [http://confluence.atlassian.com/display/JIRA/Removing+invalid+characters+from+XML+backups JIRA Atlassian site].&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic Moodle backup file under one empty folder. Moodle will create the course file folders as long as the unclean moodle.xml file. Please unzip using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Rename the unclean moodle.xml file to moodle-unclean.xml.&lt;br /&gt;
&lt;br /&gt;
* If you don&#039;t have access to your Moodle server&#039;s command prompt, using the Moodle zip feature, zip the moodle-unclean.xml file only, download the zip file locally and unzip it. It is very important to download the xml file in zipped format to avoid unwanted character encoding when transferring from an operating system to another.&lt;br /&gt;
&lt;br /&gt;
* Move the downloaded Atlassian XML Cleaner Utility in the same folder where is your moodle-unclean.xml file.&lt;br /&gt;
&lt;br /&gt;
* Issue the following command from the command prompt: &lt;br /&gt;
&lt;br /&gt;
 java -jar atlassian-xml-cleaner-0.1.jar moodle-unclean.xml &amp;gt; moodle.xml&lt;br /&gt;
&lt;br /&gt;
* If you launched the utility on your local computer, zip the just created (and hopefully cleaned) moodle.xml file and upload it in the same place from where you downloaded the moodle-unclean.xml file. Once uploaded, unzip it using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;Some of your courses weren&#039;t saved!!&amp;quot; mean?==&lt;br /&gt;
&lt;br /&gt;
There are three possible causes of this problem:&lt;br /&gt;
# Error - this happens when the backup procedure has found an error and so hasn&#039;t finished the backup of a particular course. These are &amp;quot;controlled&amp;quot; errors and the scheduled backup continues with the next course.&lt;br /&gt;
# Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the &amp;quot;crash&amp;quot; is happening at exact time intervals (usually a problem with the max_execution_time php&#039;s variable), or if there is some exact point were all the courses are breaking.&lt;br /&gt;
# Skipped - this happens when a course is unavailable to students and has not been changed in the last month (31 days). This isn&#039;t an error situation - it&#039;s a feature, especially useful for sites with many unavailable old courses, saving process time.&lt;br /&gt;
&lt;br /&gt;
==Why are some courses being skipped?==&lt;br /&gt;
&lt;br /&gt;
[[Image:autobackup_skip_settings.png|thumb|AutoBackup &#039;&#039;&#039;skip&#039;&#039;&#039; settings]]Moodle&#039;s &#039;&#039;Course backups&#039;&#039; routines are instructed to automatically skip courses based on three settings in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; Automated backup setup.&#039;&#039; The Moodle administrator(s) use those settings to specify whether to &#039;&#039;Skip hidden courses&#039;&#039; (set by default to &#039;Yes&#039;), &#039;&#039;Skip courses not modified since&#039;&#039; (set by default to &#039;30 days&#039;), and &#039;&#039;Skip courses not modified since previous backup&#039;&#039; (set by default to &#039;No&#039;). A course which meets any of the enabled criteria will be skipped during the next run of &#039;&#039;Course backups&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Why does restore stop, rather than completing?==&lt;br /&gt;
&lt;br /&gt;
Attempting to restore a course to an older version of Moodle than the one the course was backed up on can result in the restore process failing to complete. To ensure a successful restore, make sure that the version of Moodle you are restoring the course to is the same, or newer, than the one the course was backed up on.&lt;br /&gt;
&lt;br /&gt;
If it stop unexpectedly with no errors shown try again with [[Debugging]] switched on. Any errors you now see can help experts in the support forums diagnose your problem. You can also check the discussion links in the See also section below for further advice.&lt;br /&gt;
&lt;br /&gt;
==Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This message is displayed when:&lt;br /&gt;
&lt;br /&gt;
# The target site has a user xxxx (xxxx being the username) - often the admin user&lt;br /&gt;
# The backup archive being restored also contains a user xxxx (same username)&lt;br /&gt;
# After various comparisons, Moodle has determined that the target site user xxxx and the backup user xxxx aren&#039;t the same person.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 1, 2 and 3 are all true, the restore process stops in order to prevent the backup user xxxx&#039;s activities (forum posts, quiz attempts, assignment uploads, etc.) from being associated with the target site user xxxx. &lt;br /&gt;
&lt;br /&gt;
Here are the possible methods to make the xxxx users match (and resolve the conflict):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the backup archive&#039;s &#039;&#039;&#039;users.xml&#039;&#039;&#039; file and make the &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields match the ones in target site. Note that the &#039;&#039;&#039;&#039;&#039;backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039; is a [https://en.wikipedia.org/wiki/Tar_(computing) tarball] and can be extracted by creating a temporary folder and running &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. When editing is complete recompress the file with &#039;&#039;&#039;tar -czf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz *&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the target site and set the user &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields to match the ones in backup archive &#039;&#039;&#039;users.xml&#039;&#039;&#039; file.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;For admin user conflicts only: enable the setting &#039;Allow admin conflict resolution&#039; in &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General import defaults&#039;&#039;. This will result in the username in the backup file being renamed to &#039;admin_xyz&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Restored users lose their passwords - How can they reset them?==&lt;br /&gt;
&lt;br /&gt;
When a course is restored with enroled users included, any new users not already in the system will have new accounts created for them. Backups with enroled users do not include the user passwords. Instead, a password of &amp;quot;restored&amp;quot; is placed in the database for such users. When the user attempts to log into the new site, Moodle will recognise they were restored from a course backup and give the user the following message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Restored Account. &lt;br /&gt;
This account was imported from another server and the password has been lost. To set a new password by email, please click &amp;quot;Continue&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the &amp;quot;Continue&amp;quot; button, they will then be sent a change password email to the email address associated with the restored account, just as if they had used the normal &amp;quot;Forgotten password&amp;quot; process. This will allow them to set a new password.&lt;br /&gt;
&lt;br /&gt;
If you are the administrator and wish to avoid users getting such emails, remember that you can use the [[Upload users|Upload users tool]] to bulk set new passwords.&lt;br /&gt;
&lt;br /&gt;
==Why are certain course links broken in a restored course?==&lt;br /&gt;
&lt;br /&gt;
Inter-activity links must be absolute (full) URLs e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://site.com/mod/resource/view.php?id=xxx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in order to be processed properly during backup and restore.&lt;br /&gt;
&lt;br /&gt;
Any relative URLs e.g. &amp;lt;code&amp;gt;/mod/resource/view.php?id=xxx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;../resource/view.php?id=xxx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;view.php?id=xxx&amp;lt;/code&amp;gt; will result in broken links when the course is restored.&lt;br /&gt;
&lt;br /&gt;
==Restoring a course results in broken HTML tags. What can I do?==&lt;br /&gt;
This has been known to be caused by older versions of   libxml2 and PHP  - try updating them to the latest versions.&lt;br /&gt;
&lt;br /&gt;
==How can I extract original files from a Moodle backup file?==&lt;br /&gt;
If you really want to get original files from the backup file (an .mbz file) you downloaded (from the course&#039;s restore page), you can do so in much the same way as is suggested above. &lt;br /&gt;
&lt;br /&gt;
The backup file can be opened with the command &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. Create a temporary folder to extract the backup&#039;s files into.&lt;br /&gt;
&lt;br /&gt;
Next step would be to open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file in a text editor, and:&lt;br /&gt;
&lt;br /&gt;
# Search for the name of each file you want to get.&lt;br /&gt;
# Take note of the value of the corresponding contenthash tag.&lt;br /&gt;
# In the &#039;&#039;&#039;files&#039;&#039;&#039; folder you extracted, locate the file whose name is the same as the value of the contenthash and which will be located in a folder whose name corresponds to the two first characters of the file name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s assume there is a &#039;&#039;&#039;backup_courses-120730.mbz&#039;&#039;&#039; file of which the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and the &#039;&#039;&#039;files&#039;&#039;&#039; folder have been extracted. There is a PDF file named &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; that is required for another purpose.&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;&#039;files.xml&#039;&#039;&#039; file and:&lt;br /&gt;
&lt;br /&gt;
1. Search for the string &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039;, which in this case is found under the following &amp;amp;lt;file id...&amp;amp;gt; group tag:&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;file id=&amp;quot;12345&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;contenthash&amp;amp;gt;fb6cf43a9b2d432403c70a2cb4c340dbb6225631&amp;amp;lt;/contenthash&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;filename&amp;amp;gt;Leadership.pdf&amp;amp;lt;/filename&amp;amp;gt;&lt;br /&gt;
                ⋮&lt;br /&gt;
  &amp;amp;lt;license&amp;amp;gt;allrightsreserved&amp;amp;lt;/license&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;sortorder&amp;amp;gt;1&amp;amp;lt;/sortorder&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/file&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Take note of the corresponding contenthash value: fb6cf43a9b2d432403c70a2cb4c340dbb6225631.&lt;br /&gt;
&lt;br /&gt;
3. As the first two characters of the contenthash are &amp;quot;fb&amp;quot;, open the &#039;&#039;&#039;fb&#039;&#039;&#039; subfolder inside the &#039;&#039;&#039;files&#039;&#039;&#039; folder, and there is a file named &#039;&#039;&#039;fb6cf43a9b...&#039;&#039;&#039;. Rename that file as &#039;&#039;&#039;Leadership.pdf&#039;&#039;&#039; and move it to the desired location. Repeat this for all the files required, using the corresponding contenthash value each time.&lt;br /&gt;
&lt;br /&gt;
==MySQL dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=128 Backup and restore forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Moodle migration]]&lt;br /&gt;
&lt;br /&gt;
Moodle forum discussions:&lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=345466 Backing up and restoring course eliminates gradebook categories and items]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Respaldo y restauración FAQ]]&lt;br /&gt;
[[pl:Backup FAQ]]&lt;br /&gt;
[[fr:FAQ de sauvegarde]]&lt;br /&gt;
[[ja:バックアップFAQ]]&lt;br /&gt;
[[pt:FAQ sobre cópias de segurança]]&lt;br /&gt;
[[de:Sicherung und Wiederherstellung FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146302</id>
		<title>Backup and restore FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146302"/>
		<updated>2023-06-10T14:50:46Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: These errors were removed in Moodle 2.0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==How do I backup a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course backup]] and [[Automated backup setup]]. &lt;br /&gt;
&lt;br /&gt;
==How do I restore a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course restore]].&lt;br /&gt;
&lt;br /&gt;
==How do I backup my site?==&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]].&lt;br /&gt;
&lt;br /&gt;
==What are the pros and cons of course versus site backups?==&lt;br /&gt;
&lt;br /&gt;
[[Site backup|Site backups]] are recommended in order to have all data saved with the best confidence and the shortest recovery time.&lt;br /&gt;
&lt;br /&gt;
For a site administrator, [[Automated course backup|automated course backups]] are more expensive in terms of time, CPU usage and storage. The recovery time to have a site running again takes longer than a site backup. However, teachers and site administrators might find a course backups as a way to create a &amp;quot;fresh&amp;quot; copy of a course that can be re-used (in older versions of Moodle, in newer versions see [[Import course data]]) or as a method to distribute a course(s) to other Moodle sites.&lt;br /&gt;
&lt;br /&gt;
==Why is my automated course backup much smaller in size than my manual course backup?==&lt;br /&gt;
&lt;br /&gt;
This is an intentional design decision. Because of the way files are stored in Moodle 2.x, there is no need to include the files in the backup if you are planning to restore them to the same Moodle site. Leaving them out saves huge amounts of disk space and makes the backup procedure much faster. &lt;br /&gt;
&lt;br /&gt;
==What data is not contained in course backups?==&lt;br /&gt;
&lt;br /&gt;
By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:&lt;br /&gt;
* Quiz questions are only backed up if at least one question from their category has been added to a quiz.&lt;br /&gt;
* Scales are only backed up if they are used by at least one activity.&lt;br /&gt;
* Users&#039; passwords are not backed up when the &amp;quot;Include enrolled users&amp;quot; option is selected.&lt;br /&gt;
* Glossary data&lt;br /&gt;
* Badges - if they have not been awarded to at least one user and users are not included in the course backup.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student log and participation data?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include logs.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user activities can be saved as the option &amp;quot;Include course logs&amp;quot; will now appear on the backup menu of items to include in the backup. These logs provide the data that the various reports such as Course participation, Logs, and Activity report, use to produce their reports.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student grade history?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include histories.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user grade history and its changes made by teachers manually or by certain activities can be saved when performing a Backup. The option &amp;quot;Include grade history&amp;quot; will now appear on the backup menu of items to include in the backup.&lt;br /&gt;
&lt;br /&gt;
==What do the backup file names mean?==&lt;br /&gt;
&lt;br /&gt;
The default backup file name is composed of the following parts:&lt;br /&gt;
&lt;br /&gt;
*backup-moodle2-  :: This tells you that it is backup file of version 2 backup, which have been used since Moodle 2.0, and so it not a Moodle 1 backup file&lt;br /&gt;
*course-##-  ::  This tells you it is a course backup and the ## is the internal id number of the course, as seen in the course url&lt;br /&gt;
*shortname-  :: Then follows the shortname of the course as set in the course settings&lt;br /&gt;
*date-time-  ::  This is the date and time in ISO format when the backup was made&lt;br /&gt;
* nu-nf  ::  optional suffixes: If the backup does not contain enrolled users, the -nu will be added; if the backup does not include files, the -nf will be added&lt;br /&gt;
*.mbz  :: The file extension stands for &amp;quot;Moodle backup zip&amp;quot; and you can rename to .zip or .gzip (depending on your server OS) to expand it&lt;br /&gt;
&lt;br /&gt;
Example: backup-moodle2-course-27-HISTORY101-20210124-0916-nu-nf.mbz&lt;br /&gt;
&lt;br /&gt;
Deciphered: This is a backup file from Moodle 2 or above of course with id 27 with shortname HISTORY-101 made on Jan 24, 2021 at 09:16 AM with no enrolled users and no files included in it.&lt;br /&gt;
&lt;br /&gt;
==How can I backup or restore a very large course?==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;Error: An error occurred deleting old backup data&amp;quot;. What should I do?==&lt;br /&gt;
&lt;br /&gt;
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Delete old records from &amp;quot;backup_ids&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old records from &amp;quot;backup_files&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old files from &amp;quot;moodledata/temp/backup&amp;quot;: Delete the dir completely and try again.&lt;br /&gt;
&lt;br /&gt;
[[Image:BackupProblem.gif|thumb|Backup error message]]&lt;br /&gt;
For points 1 &amp;amp; 2, there are various ways of repairing tables, including using MySQL Admin.&lt;br /&gt;
&lt;br /&gt;
For point 3 see below:&lt;br /&gt;
&lt;br /&gt;
The error message states that the &amp;quot;directory not empty&amp;quot; and gives the path to that directory. If you go there with an FTP program you can see what is there and clean up. It could be just some empty subfolders that were leftover. Deleting these has been able to help. One can also delete the dir &amp;quot;moodledata/temp/backup&amp;quot; completely. That can take a bit longer but may solve several problems at once.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;XML error: not well-formed (invalid token) at line YYYY&amp;quot;. What can I do?==&lt;br /&gt;
&lt;br /&gt;
This problem can appear at any point in the restore process. It&#039;s caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it&#039;s caused by some &amp;quot;illegal&amp;quot; characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).&lt;br /&gt;
&lt;br /&gt;
The best method to handle this issue is:&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic backup file under one empty folder.&lt;br /&gt;
&lt;br /&gt;
* Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.&lt;br /&gt;
&lt;br /&gt;
* Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.&lt;br /&gt;
&lt;br /&gt;
* Test the moodle.xml file again with Firefox until no error was displayed.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but not the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
* Restore still not working? See the next question.&lt;br /&gt;
&lt;br /&gt;
Also, if possible, it&#039;s highly recommended to solve those problems in the original course too from Moodle itself. Once &amp;quot;repaired&amp;quot; there, problems will be out if you create new backup files in the future.&lt;br /&gt;
&lt;br /&gt;
==I Still get an XML error. How can I clean the borked XML file?==&lt;br /&gt;
&lt;br /&gt;
In some cases XML backup files may contain characters causing the restore process to abort, even after the steps described in the previous question. In such cases you may want to try the following:&lt;br /&gt;
&lt;br /&gt;
* Download the [https://confluence.atlassian.com/jira/files/12079/atlassian-xml-cleaner-0.1.jar Atlassian XML Cleaner Utility] from the [http://confluence.atlassian.com/display/JIRA/Removing+invalid+characters+from+XML+backups JIRA Atlassian site].&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic Moodle backup file under one empty folder. Moodle will create the course file folders as long as the unclean moodle.xml file. Please unzip using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Rename the unclean moodle.xml file to moodle-unclean.xml.&lt;br /&gt;
&lt;br /&gt;
* If you don&#039;t have access to your Moodle server&#039;s command prompt, using the Moodle zip feature, zip the moodle-unclean.xml file only, download the zip file locally and unzip it. It is very important to download the xml file in zipped format to avoid unwanted character encoding when transferring from an operating system to another.&lt;br /&gt;
&lt;br /&gt;
* Move the downloaded Atlassian XML Cleaner Utility in the same folder where is your moodle-unclean.xml file.&lt;br /&gt;
&lt;br /&gt;
* Issue the following command from the command prompt: &lt;br /&gt;
&lt;br /&gt;
 java -jar atlassian-xml-cleaner-0.1.jar moodle-unclean.xml &amp;gt; moodle.xml&lt;br /&gt;
&lt;br /&gt;
* If you launched the utility on your local computer, zip the just created (and hopefully cleaned) moodle.xml file and upload it in the same place from where you downloaded the moodle-unclean.xml file. Once uploaded, unzip it using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;Some of your courses weren&#039;t saved!!&amp;quot; mean?==&lt;br /&gt;
&lt;br /&gt;
There are three possible causes of this problem:&lt;br /&gt;
# Error - this happens when the backup procedure has found an error and so hasn&#039;t finished the backup of a particular course. These are &amp;quot;controlled&amp;quot; errors and the scheduled backup continues with the next course.&lt;br /&gt;
# Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the &amp;quot;crash&amp;quot; is happening at exact time intervals (usually a problem with the max_execution_time php&#039;s variable), or if there is some exact point were all the courses are breaking.&lt;br /&gt;
# Skipped - this happens when a course is unavailable to students and has not been changed in the last month (31 days). This isn&#039;t an error situation - it&#039;s a feature, especially useful for sites with many unavailable old courses, saving process time.&lt;br /&gt;
&lt;br /&gt;
==Why are some courses being skipped?==&lt;br /&gt;
&lt;br /&gt;
[[Image:autobackup_skip_settings.png|thumb|AutoBackup &#039;&#039;&#039;skip&#039;&#039;&#039; settings]]Moodle&#039;s &#039;&#039;Course backups&#039;&#039; routines are instructed to automatically skip courses based on three settings in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; Automated backup setup.&#039;&#039; The Moodle administrator(s) use those settings to specify whether to &#039;&#039;Skip hidden courses&#039;&#039; (set by default to &#039;Yes&#039;), &#039;&#039;Skip courses not modified since&#039;&#039; (set by default to &#039;30 days&#039;), and &#039;&#039;Skip courses not modified since previous backup&#039;&#039; (set by default to &#039;No&#039;). A course which meets any of the enabled criteria will be skipped during the next run of &#039;&#039;Course backups&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Why does restore stop, rather than completing?==&lt;br /&gt;
&lt;br /&gt;
Attempting to restore a course to an older version of Moodle than the one the course was backed up on can result in the restore process failing to complete. To ensure a successful restore, make sure that the version of Moodle you are restoring the course to is the same, or newer, than the one the course was backed up on.&lt;br /&gt;
&lt;br /&gt;
If it stop unexpectedly with no errors shown try again with [[Debugging]] switched on. Any errors you now see can help experts in the support forums diagnose your problem. You can also check the discussion links in the See also section below for further advice.&lt;br /&gt;
&lt;br /&gt;
==Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This message is displayed when:&lt;br /&gt;
&lt;br /&gt;
# The target site has a user xxxx (xxxx being the username) - often the admin user&lt;br /&gt;
# The backup archive being restored also contains a user xxxx (same username)&lt;br /&gt;
# After various comparisons, Moodle has determined that the target site user xxxx and the backup user xxxx aren&#039;t the same person.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 1, 2 and 3 are all true, the restore process stops in order to prevent the backup user xxxx&#039;s activities (forum posts, quiz attempts, assignment uploads, etc.) from being associated with the target site user xxxx. &lt;br /&gt;
&lt;br /&gt;
Here are the possible methods to make the xxxx users match (and resolve the conflict):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the backup archive&#039;s &#039;&#039;&#039;users.xml&#039;&#039;&#039; file and make the &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields match the ones in target site. Note that the &#039;&#039;&#039;&#039;&#039;backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039; is a [https://en.wikipedia.org/wiki/Tar_(computing) tarball] and can be extracted by creating a temporary folder and running &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. When editing is complete recompress the file with &#039;&#039;&#039;tar -czf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz *&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the target site and set the user &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields to match the ones in backup archive &#039;&#039;&#039;users.xml&#039;&#039;&#039; file.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;For admin user conflicts only: enable the setting &#039;Allow admin conflict resolution&#039; in &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General import defaults&#039;&#039;. This will result in the username in the backup file being renamed to &#039;admin_xyz&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Restored users lose their passwords - How can they reset them?==&lt;br /&gt;
&lt;br /&gt;
When a course is restored with enroled users included, any new users not already in the system will have new accounts created for them. Backups with enroled users do not include the user passwords. Instead, a password of &amp;quot;restored&amp;quot; is placed in the database for such users. When the user attempts to log into the new site, Moodle will recognise they were restored from a course backup and give the user the following message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Restored Account. &lt;br /&gt;
This account was imported from another server and the password has been lost. To set a new password by email, please click &amp;quot;Continue&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the &amp;quot;Continue&amp;quot; button, they will then be sent a change password email to the email address associated with the restored account, just as if they had used the normal &amp;quot;Forgotten password&amp;quot; process. This will allow them to set a new password.&lt;br /&gt;
&lt;br /&gt;
If you are the administrator and wish to avoid users getting such emails, remember that you can use the [[Upload users|Upload users tool]] to bulk set new passwords.&lt;br /&gt;
&lt;br /&gt;
==Why are certain course links broken in a restored course?==&lt;br /&gt;
&lt;br /&gt;
Inter-activity links must be absolute (full) URLs e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://site.com/mod/resource/view.php?id=xxx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in order to be processed properly during backup and restore.&lt;br /&gt;
&lt;br /&gt;
Any relative URLs e.g. &amp;lt;code&amp;gt;/mod/resource/view.php?id=xxx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;../resource/view.php?id=xxx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;view.php?id=xxx&amp;lt;/code&amp;gt; will result in broken links when the course is restored.&lt;br /&gt;
&lt;br /&gt;
==Restoring a course results in broken HTML tags. What can I do?==&lt;br /&gt;
This has been known to be caused by older versions of   libxml2 and PHP  - try updating them to the latest versions.&lt;br /&gt;
&lt;br /&gt;
==How can I extract original files from a Moodle backup file?==&lt;br /&gt;
If you really want to get original files from the backup file (an &amp;quot;.mbz&amp;quot; file) you downloaded (using the backup and restore feature), you can do so in much the same way as is suggested above. &lt;br /&gt;
&lt;br /&gt;
The backup file can actually be opened with any zip/unzip program you can download. Once you open the file, you need to extract:&lt;br /&gt;
&lt;br /&gt;
    The files.xml file.&lt;br /&gt;
    The files directory (folder).&lt;br /&gt;
&lt;br /&gt;
Next step would be to open the &amp;quot;files.xml&amp;quot; file in a text editor, and:&lt;br /&gt;
&lt;br /&gt;
    Search for the name of each file you want to get.&lt;br /&gt;
    Take note of the value of the corresponding contenthash tag.&lt;br /&gt;
    In the &amp;quot;files&amp;quot; folder you extracted, locate the file whose name is the same as the value of the contenthash and which will always be located in a folder whose name corresponds to the two first characters of the file name.&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s assume there is a &amp;quot;backup_courses-120730.mbz&amp;quot; file of which the &amp;quot;files.xml&amp;quot; file and the &amp;quot;files&amp;quot; folder have been extracted. There is a PDF file named &amp;quot;Leadership.pdf&amp;quot; that is required for another purpose.&lt;br /&gt;
&lt;br /&gt;
Open the files.xml file and:&lt;br /&gt;
&lt;br /&gt;
1. Search for the string &amp;quot;Leadership.pdf&amp;quot;, which in this case is found under the following &amp;amp;lt;file id...&amp;amp;gt; group tag:&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;file id=&amp;quot;12345&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;contenthash&amp;amp;gt;fb6cf43a9b2d432403c70a2cb4c340dbb6225631&amp;amp;lt;/contenthash&amp;amp;gt;&lt;br /&gt;
                :&lt;br /&gt;
  &amp;amp;lt;filename&amp;amp;gt;Leadership.pdf&amp;amp;lt;/filename&amp;amp;gt;&lt;br /&gt;
                :&lt;br /&gt;
  &amp;amp;lt;license&amp;amp;gt;allrightsreserved&amp;amp;lt;/license&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;sortorder&amp;amp;gt;1&amp;amp;lt;/sortorder&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/file&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Take note of the corresponding contenthash value: fb6cf43a9b2d432403c70a2cb4c340dbb6225631.&lt;br /&gt;
&lt;br /&gt;
3. As the first two characters of the contenthash are &amp;quot;fb&amp;quot;, open the &amp;quot;fb&amp;quot; folder inside the &amp;quot;files&amp;quot; directory (which was previously extracted), and there is a file named &amp;quot;fb6cf43a9b...&amp;quot;. Rename that file as &amp;quot;Leadership.pdf&amp;quot;, and then move it to another location. Repeat this for all the files required, using the correct contenthash value of course.&lt;br /&gt;
&lt;br /&gt;
==MySQL dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=128 Backup and restore forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Moodle migration]]&lt;br /&gt;
&lt;br /&gt;
Moodle forum discussions:&lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=345466 Backing up and restoring course eliminates gradebook categories and items]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Respaldo y restauración FAQ]]&lt;br /&gt;
[[pl:Backup FAQ]]&lt;br /&gt;
[[fr:FAQ de sauvegarde]]&lt;br /&gt;
[[ja:バックアップFAQ]]&lt;br /&gt;
[[pt:FAQ sobre cópias de segurança]]&lt;br /&gt;
[[de:Sicherung und Wiederherstellung FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146301</id>
		<title>Backup and restore FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Backup_and_restore_FAQ&amp;diff=146301"/>
		<updated>2023-06-10T14:44:48Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot; */ MBZ files are tarballs not zip files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Backup}}&lt;br /&gt;
==How do I backup a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course backup]] and [[Automated backup setup]]. &lt;br /&gt;
&lt;br /&gt;
==How do I restore a course?==&lt;br /&gt;
&lt;br /&gt;
See [[Course restore]].&lt;br /&gt;
&lt;br /&gt;
==How do I backup my site?==&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]].&lt;br /&gt;
&lt;br /&gt;
==What are the pros and cons of course versus site backups?==&lt;br /&gt;
&lt;br /&gt;
[[Site backup|Site backups]] are recommended in order to have all data saved with the best confidence and the shortest recovery time.&lt;br /&gt;
&lt;br /&gt;
For a site administrator, [[Automated course backup|automated course backups]] are more expensive in terms of time, CPU usage and storage. The recovery time to have a site running again takes longer than a site backup. However, teachers and site administrators might find a course backups as a way to create a &amp;quot;fresh&amp;quot; copy of a course that can be re-used (in older versions of Moodle, in newer versions see [[Import course data]]) or as a method to distribute a course(s) to other Moodle sites.&lt;br /&gt;
&lt;br /&gt;
==Why is my automated course backup much smaller in size than my manual course backup?==&lt;br /&gt;
&lt;br /&gt;
This is an intentional design decision. Because of the way files are stored in Moodle 2.x, there is no need to include the files in the backup if you are planning to restore them to the same Moodle site. Leaving them out saves huge amounts of disk space and makes the backup procedure much faster. &lt;br /&gt;
&lt;br /&gt;
==What data is not contained in course backups?==&lt;br /&gt;
&lt;br /&gt;
By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:&lt;br /&gt;
* Quiz questions are only backed up if at least one question from their category has been added to a quiz.&lt;br /&gt;
* Scales are only backed up if they are used by at least one activity.&lt;br /&gt;
* Users&#039; passwords are not backed up when the &amp;quot;Include enrolled users&amp;quot; option is selected.&lt;br /&gt;
* Glossary data&lt;br /&gt;
* Badges - if they have not been awarded to at least one user and users are not included in the course backup.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student log and participation data?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include logs.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user activities can be saved as the option &amp;quot;Include course logs&amp;quot; will now appear on the backup menu of items to include in the backup. These logs provide the data that the various reports such as Course participation, Logs, and Activity report, use to produce their reports.&lt;br /&gt;
&lt;br /&gt;
==How do I fix backups that lack the student grade history?==&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General backup defaults&#039;&#039;, there is a setting for &amp;quot;Include histories.&amp;quot; By default, this is off.&lt;br /&gt;
&lt;br /&gt;
If you enable this, then the logs from the user grade history and its changes made by teachers manually or by certain activities can be saved when performing a Backup. The option &amp;quot;Include grade history&amp;quot; will now appear on the backup menu of items to include in the backup.&lt;br /&gt;
&lt;br /&gt;
==What do the backup file names mean?==&lt;br /&gt;
&lt;br /&gt;
The default backup file name is composed of the following parts:&lt;br /&gt;
&lt;br /&gt;
*backup-moodle2-  :: This tells you that it is backup file of version 2 backup, which have been used since Moodle 2.0, and so it not a Moodle 1 backup file&lt;br /&gt;
*course-##-  ::  This tells you it is a course backup and the ## is the internal id number of the course, as seen in the course url&lt;br /&gt;
*shortname-  :: Then follows the shortname of the course as set in the course settings&lt;br /&gt;
*date-time-  ::  This is the date and time in ISO format when the backup was made&lt;br /&gt;
* nu-nf  ::  optional suffixes: If the backup does not contain enrolled users, the -nu will be added; if the backup does not include files, the -nf will be added&lt;br /&gt;
*.mbz  :: The file extension stands for &amp;quot;Moodle backup zip&amp;quot; and you can rename to .zip or .gzip (depending on your server OS) to expand it&lt;br /&gt;
&lt;br /&gt;
Example: backup-moodle2-course-27-HISTORY101-20210124-0916-nu-nf.mbz&lt;br /&gt;
&lt;br /&gt;
Deciphered: This is a backup file from Moodle 2 or above of course with id 27 with shortname HISTORY-101 made on Jan 24, 2021 at 09:16 AM with no enrolled users and no files included in it.&lt;br /&gt;
&lt;br /&gt;
==How can I backup or restore a very large course?==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;Error: An error occurred deleting old backup data&amp;quot;. What should I do?==&lt;br /&gt;
&lt;br /&gt;
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Delete old records from &amp;quot;backup_ids&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old records from &amp;quot;backup_files&amp;quot; table: Check the table exists, repair it and try again.&lt;br /&gt;
# Delete old files from &amp;quot;moodledata/temp/backup&amp;quot;: Delete the dir completely and try again.&lt;br /&gt;
&lt;br /&gt;
[[Image:BackupProblem.gif|thumb|Backup error message]]&lt;br /&gt;
For points 1 &amp;amp; 2, there are various ways of repairing tables, including using MySQL Admin.&lt;br /&gt;
&lt;br /&gt;
For point 3 see below:&lt;br /&gt;
&lt;br /&gt;
The error message states that the &amp;quot;directory not empty&amp;quot; and gives the path to that directory. If you go there with an FTP program you can see what is there and clean up. It could be just some empty subfolders that were leftover. Deleting these has been able to help. One can also delete the dir &amp;quot;moodledata/temp/backup&amp;quot; completely. That can take a bit longer but may solve several problems at once.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;XML error: not well-formed (invalid token) at line YYYY&amp;quot;. What can I do?==&lt;br /&gt;
&lt;br /&gt;
This problem can appear at any point in the restore process. It&#039;s caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it&#039;s caused by some &amp;quot;illegal&amp;quot; characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).&lt;br /&gt;
&lt;br /&gt;
The best method to handle this issue is:&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic backup file under one empty folder.&lt;br /&gt;
&lt;br /&gt;
* Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.&lt;br /&gt;
&lt;br /&gt;
* Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.&lt;br /&gt;
&lt;br /&gt;
* Test the moodle.xml file again with Firefox until no error was displayed.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but not the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
* Restore still not working? See the next question.&lt;br /&gt;
&lt;br /&gt;
Also, if possible, it&#039;s highly recommended to solve those problems in the original course too from Moodle itself. Once &amp;quot;repaired&amp;quot; there, problems will be out if you create new backup files in the future.&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;moodle xml not found at root level of zip file&amp;quot;. What can I do?==&lt;br /&gt;
If you are restoring from a zip file backup make sure the moodle.xml file is at the root level. To ensure this:&lt;br /&gt;
#Unzip the backup file of the course (example: mycourse.zip)&lt;br /&gt;
#Once the file is unzipped, open the folder (example: mycourse).&lt;br /&gt;
#Select the folders within the mycourse folder AND the moodle.xml file and create a zip of those item (example: mycourse_new.zip)&lt;br /&gt;
#Upload the new zip file (example: mycourse_new.zip) and restore from that.&lt;br /&gt;
&lt;br /&gt;
If the backup file is guaranteed to be correct, check paths to external files (zip, unzip). Incorrect settings also lead to this error message (see the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=140355 moodle.xml not found in root...] and MDL-14812).&lt;br /&gt;
&lt;br /&gt;
==The process ends with: &amp;quot;An error occurred while copying the zip file...&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This problem is most likely caused by a permissions issue in the destination directory. Backup files are copied to &amp;quot;XXX/backupdata&amp;quot; under your dataroot directory (where XXX is the id of the course being backed up).&lt;br /&gt;
&lt;br /&gt;
The problem could also be caused by a disk being full, though this is far less likely.&lt;br /&gt;
&lt;br /&gt;
To obtain precise information about what&#039;s happening, you can enable debug messages in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Debugging]]&#039;&#039; (select the maximum level - DEVELOPER) and/or check the web server error logs.&lt;br /&gt;
&lt;br /&gt;
==I Still get an XML error. How can I clean the borked XML file?==&lt;br /&gt;
&lt;br /&gt;
In some cases XML backup files may contain characters causing the restore process to abort, even after the steps described in the previous question. In such cases you may want to try the following:&lt;br /&gt;
&lt;br /&gt;
* Download the [https://confluence.atlassian.com/jira/files/12079/atlassian-xml-cleaner-0.1.jar Atlassian XML Cleaner Utility] from the [http://confluence.atlassian.com/display/JIRA/Removing+invalid+characters+from+XML+backups JIRA Atlassian site].&lt;br /&gt;
&lt;br /&gt;
* Unzip the problematic Moodle backup file under one empty folder. Moodle will create the course file folders as long as the unclean moodle.xml file. Please unzip using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Rename the unclean moodle.xml file to moodle-unclean.xml.&lt;br /&gt;
&lt;br /&gt;
* If you don&#039;t have access to your Moodle server&#039;s command prompt, using the Moodle zip feature, zip the moodle-unclean.xml file only, download the zip file locally and unzip it. It is very important to download the xml file in zipped format to avoid unwanted character encoding when transferring from an operating system to another.&lt;br /&gt;
&lt;br /&gt;
* Move the downloaded Atlassian XML Cleaner Utility in the same folder where is your moodle-unclean.xml file.&lt;br /&gt;
&lt;br /&gt;
* Issue the following command from the command prompt: &lt;br /&gt;
&lt;br /&gt;
 java -jar atlassian-xml-cleaner-0.1.jar moodle-unclean.xml &amp;gt; moodle.xml&lt;br /&gt;
&lt;br /&gt;
* If you launched the utility on your local computer, zip the just created (and hopefully cleaned) moodle.xml file and upload it in the same place from where you downloaded the moodle-unclean.xml file. Once uploaded, unzip it using the Moodle unzip feature.&lt;br /&gt;
&lt;br /&gt;
* Zip everything again (all the folder contents but the folder itself!).&lt;br /&gt;
&lt;br /&gt;
* Restore the course. It should work now.&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;Some of your courses weren&#039;t saved!!&amp;quot; mean?==&lt;br /&gt;
&lt;br /&gt;
There are three possible causes of this problem:&lt;br /&gt;
# Error - this happens when the backup procedure has found an error and so hasn&#039;t finished the backup of a particular course. These are &amp;quot;controlled&amp;quot; errors and the scheduled backup continues with the next course.&lt;br /&gt;
# Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the &amp;quot;crash&amp;quot; is happening at exact time intervals (usually a problem with the max_execution_time php&#039;s variable), or if there is some exact point were all the courses are breaking.&lt;br /&gt;
# Skipped - this happens when a course is unavailable to students and has not been changed in the last month (31 days). This isn&#039;t an error situation - it&#039;s a feature, especially useful for sites with many unavailable old courses, saving process time.&lt;br /&gt;
&lt;br /&gt;
==Why are some courses being skipped?==&lt;br /&gt;
&lt;br /&gt;
[[Image:autobackup_skip_settings.png|thumb|AutoBackup &#039;&#039;&#039;skip&#039;&#039;&#039; settings]]Moodle&#039;s &#039;&#039;Course backups&#039;&#039; routines are instructed to automatically skip courses based on three settings in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; Automated backup setup.&#039;&#039; The Moodle administrator(s) use those settings to specify whether to &#039;&#039;Skip hidden courses&#039;&#039; (set by default to &#039;Yes&#039;), &#039;&#039;Skip courses not modified since&#039;&#039; (set by default to &#039;30 days&#039;), and &#039;&#039;Skip courses not modified since previous backup&#039;&#039; (set by default to &#039;No&#039;). A course which meets any of the enabled criteria will be skipped during the next run of &#039;&#039;Course backups&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Why does restore stop, rather than completing?==&lt;br /&gt;
&lt;br /&gt;
Attempting to restore a course to an older version of Moodle than the one the course was backed up on can result in the restore process failing to complete. To ensure a successful restore, make sure that the version of Moodle you are restoring the course to is the same, or newer, than the one the course was backed up on.&lt;br /&gt;
&lt;br /&gt;
If it stop unexpectedly with no errors shown try again with [[Debugging]] switched on. Any errors you now see can help experts in the support forums diagnose your problem. You can also check the discussion links in the See also section below for further advice.&lt;br /&gt;
&lt;br /&gt;
==Restore stops with the message &amp;quot;Trying to restore user xxxx from backup file will cause conflict&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
This message is displayed when:&lt;br /&gt;
&lt;br /&gt;
# The target site has a user xxxx (xxxx being the username) - often the admin user&lt;br /&gt;
# The backup archive being restored also contains a user xxxx (same username)&lt;br /&gt;
# After various comparisons, Moodle has determined that the target site user xxxx and the backup user xxxx aren&#039;t the same person.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 1, 2 and 3 are all true, the restore process stops in order to prevent the backup user xxxx&#039;s activities (forum posts, quiz attempts, assignment uploads, etc.) from being associated with the target site user xxxx. &lt;br /&gt;
&lt;br /&gt;
Here are the possible methods to make the xxxx users match (and resolve the conflict):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the backup archive&#039;s &#039;&#039;&#039;users.xml&#039;&#039;&#039; file and make the &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields match the ones in target site. Note that the &#039;&#039;&#039;&#039;&#039;backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039; is a [https://en.wikipedia.org/wiki/Tar_(computing) tarball] and can be extracted by creating a temporary folder and running &#039;&#039;&#039;tar -xzf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz&#039;&#039;&#039;. When editing is complete recompress the file with &#039;&#039;&#039;tar -czf &#039;&#039;/PATH/TO/backup-&amp;lt;...&amp;gt;&#039;&#039;.mbz *&#039;&#039;&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Modify the target site and set the user &#039;&#039;email&#039;&#039; or &#039;&#039;firstaccess&#039;&#039; fields to match the ones in backup archive &#039;&#039;&#039;users.xml&#039;&#039;&#039; file.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;For admin user conflicts only: enable the setting &#039;Allow admin conflict resolution&#039; in &#039;&#039;Site administration &amp;gt; Courses &amp;gt; Backups &amp;gt; General import defaults&#039;&#039;. This will result in the username in the backup file being renamed to &#039;admin_xyz&#039;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Restored users lose their passwords - How can they reset them?==&lt;br /&gt;
&lt;br /&gt;
When a course is restored with enroled users included, any new users not already in the system will have new accounts created for them. Backups with enroled users do not include the user passwords. Instead, a password of &amp;quot;restored&amp;quot; is placed in the database for such users. When the user attempts to log into the new site, Moodle will recognise they were restored from a course backup and give the user the following message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Restored Account. &lt;br /&gt;
This account was imported from another server and the password has been lost. To set a new password by email, please click &amp;quot;Continue&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the &amp;quot;Continue&amp;quot; button, they will then be sent a change password email to the email address associated with the restored account, just as if they had used the normal &amp;quot;Forgotten password&amp;quot; process. This will allow them to set a new password.&lt;br /&gt;
&lt;br /&gt;
If you are the administrator and wish to avoid users getting such emails, remember that you can use the [[Upload users|Upload users tool]] to bulk set new passwords.&lt;br /&gt;
&lt;br /&gt;
==Why are certain course links broken in a restored course?==&lt;br /&gt;
&lt;br /&gt;
Inter-activity links must be absolute (full) URLs e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://site.com/mod/resource/view.php?id=xxx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in order to be processed properly during backup and restore.&lt;br /&gt;
&lt;br /&gt;
Any relative URLs e.g. &amp;lt;code&amp;gt;/mod/resource/view.php?id=xxx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;../resource/view.php?id=xxx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;view.php?id=xxx&amp;lt;/code&amp;gt; will result in broken links when the course is restored.&lt;br /&gt;
&lt;br /&gt;
==Restoring a course results in broken HTML tags. What can I do?==&lt;br /&gt;
This has been known to be caused by older versions of   libxml2 and PHP  - try updating them to the latest versions.&lt;br /&gt;
&lt;br /&gt;
==How can I extract original files from a Moodle backup file?==&lt;br /&gt;
If you really want to get original files from the backup file (an &amp;quot;.mbz&amp;quot; file) you downloaded (using the backup and restore feature), you can do so in much the same way as is suggested above. &lt;br /&gt;
&lt;br /&gt;
The backup file can actually be opened with any zip/unzip program you can download. Once you open the file, you need to extract:&lt;br /&gt;
&lt;br /&gt;
    The files.xml file.&lt;br /&gt;
    The files directory (folder).&lt;br /&gt;
&lt;br /&gt;
Next step would be to open the &amp;quot;files.xml&amp;quot; file in a text editor, and:&lt;br /&gt;
&lt;br /&gt;
    Search for the name of each file you want to get.&lt;br /&gt;
    Take note of the value of the corresponding contenthash tag.&lt;br /&gt;
    In the &amp;quot;files&amp;quot; folder you extracted, locate the file whose name is the same as the value of the contenthash and which will always be located in a folder whose name corresponds to the two first characters of the file name.&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s assume there is a &amp;quot;backup_courses-120730.mbz&amp;quot; file of which the &amp;quot;files.xml&amp;quot; file and the &amp;quot;files&amp;quot; folder have been extracted. There is a PDF file named &amp;quot;Leadership.pdf&amp;quot; that is required for another purpose.&lt;br /&gt;
&lt;br /&gt;
Open the files.xml file and:&lt;br /&gt;
&lt;br /&gt;
1. Search for the string &amp;quot;Leadership.pdf&amp;quot;, which in this case is found under the following &amp;amp;lt;file id...&amp;amp;gt; group tag:&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;file id=&amp;quot;12345&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;contenthash&amp;amp;gt;fb6cf43a9b2d432403c70a2cb4c340dbb6225631&amp;amp;lt;/contenthash&amp;amp;gt;&lt;br /&gt;
                :&lt;br /&gt;
  &amp;amp;lt;filename&amp;amp;gt;Leadership.pdf&amp;amp;lt;/filename&amp;amp;gt;&lt;br /&gt;
                :&lt;br /&gt;
  &amp;amp;lt;license&amp;amp;gt;allrightsreserved&amp;amp;lt;/license&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;sortorder&amp;amp;gt;1&amp;amp;lt;/sortorder&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/file&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Take note of the corresponding contenthash value: fb6cf43a9b2d432403c70a2cb4c340dbb6225631.&lt;br /&gt;
&lt;br /&gt;
3. As the first two characters of the contenthash are &amp;quot;fb&amp;quot;, open the &amp;quot;fb&amp;quot; folder inside the &amp;quot;files&amp;quot; directory (which was previously extracted), and there is a file named &amp;quot;fb6cf43a9b...&amp;quot;. Rename that file as &amp;quot;Leadership.pdf&amp;quot;, and then move it to another location. Repeat this for all the files required, using the correct contenthash value of course.&lt;br /&gt;
&lt;br /&gt;
==MySQL dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=128 Backup and restore forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Moodle migration]]&lt;br /&gt;
&lt;br /&gt;
Moodle forum discussions:&lt;br /&gt;
*[https://moodle.org/mod/forum/discuss.php?d=345466 Backing up and restoring course eliminates gradebook categories and items]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Respaldo y restauración FAQ]]&lt;br /&gt;
[[pl:Backup FAQ]]&lt;br /&gt;
[[fr:FAQ de sauvegarde]]&lt;br /&gt;
[[ja:バックアップFAQ]]&lt;br /&gt;
[[pt:FAQ sobre cópias de segurança]]&lt;br /&gt;
[[de:Sicherung und Wiederherstellung FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Using_Assignment&amp;diff=146088</id>
		<title>Using Assignment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Using_Assignment&amp;diff=146088"/>
		<updated>2023-05-06T13:00:54Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* File submission */ Fix button text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Assignment}}&lt;br /&gt;
This page  explores the different types of assignment, how students submit assignments and how teachers can grade them.&lt;br /&gt;
&lt;br /&gt;
==What are the options for submitting work in Moodle?==&lt;br /&gt;
The standard ways students can submit assignments are:&lt;br /&gt;
* File submissions (students submit a file for assessment)&lt;br /&gt;
* Online text (students can type their responses directly in Moodle)&lt;br /&gt;
* Audio or video (via the recording button in the [[Atto editor]])&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
# It is also possible to use the assignment for grading an &amp;quot;offline assignment&amp;quot;, ie, one where work is done outside of Moodle. This is done by simply unchecking the above three options.&lt;br /&gt;
# If you&#039;re not sure which assignment type best suits your needs, look at the section below [[#Which type of assignment submission suits you best?]]&lt;br /&gt;
&lt;br /&gt;
==Which type of assignment submission suits you best?==&lt;br /&gt;
&lt;br /&gt;
===You want students to type shorter or longer responses directly online===&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;Online text&#039;&#039; to Yes. This works well for younger children who will only manage a sentence or two and works just as well for higher education students who write more. &lt;br /&gt;
*Advantage - quick for the student to get started; no need to use a word-processing program and upload the file. The text is saved on a regular basis so it will be preserved if the  student loses the page for some reason.&lt;br /&gt;
*Disadvantage: if the word count is expected to be large, setting &#039;&#039;Online text&#039;&#039; to No and &#039;&#039;File submission&#039;&#039; to Yes might be a better option.&lt;br /&gt;
&lt;br /&gt;
===You want students to submit work you can download in a specified program===&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;File submission&#039;&#039; to Yes, set the number of files you will allow using the &#039;&#039;Maximum number of uploaded files&#039;&#039; setting and the file sizes by using the &#039;&#039; Maximum submission size&#039;&#039; setting.&lt;br /&gt;
*Advantage - better than students emailing work as the whole class&#039;s work is collated in one space on your course. Markers can provide comments directly on the student work.&lt;br /&gt;
*Advantage - with &amp;quot;Attempts reopened&amp;quot; enabled, teachers can see the progression through various drafts of a student&#039;s work.&lt;br /&gt;
*Disadvantage - assignments must downloaded to be viewed (but they can be [[Assignment_FAQ| downloaded in bulk]]) and the teacher needs the appropriate program to open them.&lt;br /&gt;
&lt;br /&gt;
===You want students to submit files at different times for a project===&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;File submission&#039;&#039; to Yes, and use &#039;&#039;Maximum number of uploaded files&#039;&#039; to set the maximum number of separate files they can upload&lt;br /&gt;
*Advantage - all project files are in one assignment area for grading so they get a single grade.&lt;br /&gt;
*Disadvantage - all project files are in one assignment area for grading - so they can only have  a single grade!&lt;br /&gt;
===You want students to write a response to a video/sound file/image===&lt;br /&gt;
&lt;br /&gt;
Set up an assignment allowing &#039;&#039;online text&#039;&#039; submission and get students to use the Moodle media icon to add video/sound/image files. &lt;br /&gt;
&lt;br /&gt;
===You want students to answer a series of questions on a video/sound file/image===&lt;br /&gt;
&lt;br /&gt;
Investigate the [[Quiz]] module. Assignments are really just for a single question.&lt;br /&gt;
&lt;br /&gt;
===You want to grade work students have done offline===&lt;br /&gt;
Uncheck the submission types when setting up the assignment. Students won&#039;t be required to do anything but you can use the assignment to grade them for work done outside of Moodle.&lt;br /&gt;
&lt;br /&gt;
===You want to view, comment on and send back students&#039; assignments===&lt;br /&gt;
&lt;br /&gt;
Set up an assignment allowing &#039;&#039;file submissions&#039;&#039;.&lt;br /&gt;
*Advantage: useful for teachers who like using the &amp;quot;comment&amp;quot; options in word-processing programs for example. If you have Ghostscript enabled on your server and the students upload PDF files, you can annotate them inline. See the section [[Using Assignment#Annotating PDF files| Annotating PDF files]] below.&lt;br /&gt;
*Disadvantage: if students upload other file types, you have to download them, comment and then re-upload them.&lt;br /&gt;
&lt;br /&gt;
===You want students to send you a comment or note along with their uploaded work===&lt;br /&gt;
&lt;br /&gt;
If [[Comments#Enabling_comments|comments are enabled site-wide]], students will be able to add submission comments; if comments are disabled site-wide, students will not be given the option to add submission comments.&lt;br /&gt;
&lt;br /&gt;
===You want to allow students to redraft and decide when to submit the work===&lt;br /&gt;
&lt;br /&gt;
In the settings set &#039;&#039;Require students click submit button&#039;&#039; to Yes. Students can then control when their draft work is submitted to the teacher. &lt;br /&gt;
&lt;br /&gt;
===You want students to keep an ongoing journal or do an iterative assignment===&lt;br /&gt;
&lt;br /&gt;
In the settings set &#039;&#039;Require students click submit button&#039;&#039; to No. Students can continue to make changes to their assignment and at no point do they &#039;submit&#039;. If the work will be graded at some point it is recommended that either &#039;&#039;Prevent late submissions&#039;&#039; is set to Yes to ensure that no changes can be made after the due date, or [[Using_Assignment#Submission_status| all submissions are locked]] when grading commences to ensure that the work is not altered during grading.&lt;br /&gt;
*Advantage: the work remains in one place and is constantly improved, graded (if needed) and improved again. &lt;br /&gt;
*Disadvantage: there is no record/history of previous attempts (such as with the [[Wiki]]). The online text assignment does not replicate the display of a journal or blog where each new entry is additional to the previous ones.&lt;br /&gt;
&lt;br /&gt;
===You want students to submit work in groups===&lt;br /&gt;
&lt;br /&gt;
In the settings, set &amp;quot;Students submit in groups&amp;quot; to Yes. If you just do this, then once one student has submitted, the assignment will be flagged as submitted even if the others haven&#039;t contributed. If you want to ensure everyone has an input, set &amp;quot;Require students click submit button&amp;quot; to Yes and then change &amp;quot;Require all group members to submit&amp;quot; to Yes. The assignment will only be classed as submitted when each member has contributed, and once one student has submitted, the remaining members&#039;s names will be displayed for the group to see who still needs to add their input.&lt;br /&gt;
&lt;br /&gt;
===You want to grade students&#039; work anonymously===&lt;br /&gt;
In the settings, choose &#039;Anonymous submissions&#039;. When students submit assignments, their names will be replaced by randomly-generated participant numbers so you will not know who is who. Note that this is not &#039;&#039;&#039;totally&#039;&#039;&#039; anonymous because you can reveal their identities in the assignment settings and you can work out identities from the logs - so this might  not be suitable if your establishment has very precise privacy requirements.&lt;br /&gt;
&lt;br /&gt;
===You want to read and grade student assignments offline===&lt;br /&gt;
In the settings, choose &amp;quot;Offline grading worksheet&amp;quot;. When students have submitted, click &amp;quot;View/grade all submissions&amp;quot; and you can download their assignments from the link &amp;quot;Download all submissions&amp;quot; and download the grading sheet from the link &amp;quot;Download grading worksheet&amp;quot;. You can then edit grades and re-upload the grading worksheet. You can also upload multiple feedback files in a zip from this drop down menu. See [[Assignment settings]] for an explanation of how to use the &amp;quot;upload multiple feedback files as zip&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
===You want to hide students&#039; grades until a time of your choosing.===&lt;br /&gt;
Use &#039;marking workflow&#039; as explained in [[Assignment settings]].&lt;br /&gt;
&lt;br /&gt;
===You want to moderate other colleagues&#039; marking or allocate certain teachers to certain students===&lt;br /&gt;
Use &#039;marking allocation&#039; as explained in [[Assignment settings]].&lt;br /&gt;
&lt;br /&gt;
==How do students submit their assignments?==&lt;br /&gt;
The first page students will see when they click on the assignment activity link from the course page will display the assignment name, description and the submission status. The first time a student views the assignment it will look like this:&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:statuses.jpg|thumb|Student view of assignment]] &lt;br /&gt;
|}&lt;br /&gt;
The submission status section includes:&lt;br /&gt;
*&#039;&#039;&#039;Submission status&#039;&#039;&#039; &lt;br /&gt;
*&#039;&#039;&#039;Grading status&#039;&#039;&#039;&lt;br /&gt;
*Due date&lt;br /&gt;
*Time remaining&lt;br /&gt;
*Last modified&lt;br /&gt;
*Submission details&lt;br /&gt;
&lt;br /&gt;
As they progress through the assignment the Submission status and Grading status will update and the Last modified date will appear.&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:submission statuses graded.jpg|thumb|Example of submitted and graded assignment]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the student uploaded a file which the teacher has annotated, this will be made available in the feedback section. The student can search through the document and filter specific comments.&lt;br /&gt;
{|&lt;br /&gt;
|[[File:26pdfstudentgraded.png|thumb|Student view of graded pdf file]]&lt;br /&gt;
|[[File:26searchcomments.png|thumb|Searching and filtering comments in annotated pdf]]&lt;br /&gt;
|}&lt;br /&gt;
Submission statuses include:&lt;br /&gt;
&lt;br /&gt;
*Nothing submitted for this assignment&lt;br /&gt;
*Draft (not submitted)&lt;br /&gt;
*Submitted for grading&lt;br /&gt;
&lt;br /&gt;
Grading statuses include:&lt;br /&gt;
&lt;br /&gt;
*Not graded&lt;br /&gt;
*Graded&lt;br /&gt;
&lt;br /&gt;
===File submission===&lt;br /&gt;
To submit a file submission, students complete the following steps:&lt;br /&gt;
&lt;br /&gt;
# Click the ‘Add submission’ button to bring up the file upload page.&lt;br /&gt;
# Upload the relevant file into the submission. They are able to ‘drag and drop’ the file into the submission box.&lt;br /&gt;
# Click ‘Save Changes’.&lt;br /&gt;
&lt;br /&gt;
There should now be a Last modified date and the file(s) uploaded will also be displayed. Depending on how the assignment is setup the status will either read ‘Submitted for grading’ - in which case no further action is need, or ‘Draft (not submitted)’.&lt;br /&gt;
&lt;br /&gt;
# If changes are required, click ‘Edit submission’.&lt;br /&gt;
# Once ready to submit, click ‘Submit assignment’.&lt;br /&gt;
&lt;br /&gt;
Note that once the assignment is &#039;submitted’ no further changes are allowed.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:file upload.jpg|thumb|Student view when adding a submission]]&lt;br /&gt;
|[[File:file uploaded.jpg|thumb|Student view once file is uploaded]]&lt;br /&gt;
|[[File:submit button.jpg|thumb|Student view when submitting assignment]]&lt;br /&gt;
|}&lt;br /&gt;
Note: Depending on how the assignment is setup students may see both a file submission page and an online text editor.&lt;br /&gt;
&lt;br /&gt;
If file submissions and online text are enabled, and a word limit is set for the online text, it is possible for a student to end up with a submission status of &#039;No attempt&#039; together with saved file submissions. This occurs when a student submits files, enters online text, clicks &#039;Save changes&#039; then obtains a message informing them that the text exceeds the word limit. If they then click Cancel, the submission status is shown as &#039;No attempt&#039; together with saved file submissions.&lt;br /&gt;
&lt;br /&gt;
===Access controlled links===&lt;br /&gt;
If the administrator has enabled this feature for either the [[Google Drive repository]] or the [[OneDrive repository]] then students can upload a file as an &#039;access controlled link&#039; from either of these repositories. The file is then copied to the site account and the student is no longer able to edit it.The student retains the original file in their own Google Drive or OneDrive. The teacher is given permission to edit the file for grading purposes, and the student is sent a copy of the edited file.&lt;br /&gt;
[[File:accesscontrolledlink.png|center|thumb|Student submits an access controlled link]]&lt;br /&gt;
&lt;br /&gt;
===Online text===&lt;br /&gt;
To submit  online text, students complete the following steps:&lt;br /&gt;
&lt;br /&gt;
# Click the ‘Add submission’ button to bring up the online text editor page. &lt;br /&gt;
# Type the relevant text into the [[Text_editor|text editor]], or paste from a previously written file.&lt;br /&gt;
# Click ‘Save Changes’.&lt;br /&gt;
&lt;br /&gt;
There should now be a Last modified date and the first 100 characters entered will also be displayed. Depending on how the assignment is setup the status will either read ‘Submitted for grading’ - in which case no further action is need, or ‘Draft (not submitted)’.&lt;br /&gt;
&lt;br /&gt;
# If changes are required, click on ‘Edit my submission’.&lt;br /&gt;
# Once ready to submit, click ‘Submit assignment’.&lt;br /&gt;
&lt;br /&gt;
Note that once the assignment is &#039;submitted’ no further changes are allowed.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:online text entered.jpg|thumb|Online text entered]]&lt;br /&gt;
|[[File:submit button online text.jpg|thumb|Submitting assignment]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Submission comments===&lt;br /&gt;
If enabled by the administrator,  there may be a section where students can leave submission comments.&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:student comments.jpg|thumb|Student comments]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==How do teachers grade assignments?==&lt;br /&gt;
When students have submitted their assignments, they can be accessed by clicking on the assignment activity. This will bring up the Grading Summary page.&lt;br /&gt;
&lt;br /&gt;
The Grading Summary page displays a summary of the assignment, including; number of participants, number of drafts, number of submitted assignments, due date and time remaining.&lt;br /&gt;
&lt;br /&gt;
Clicking &#039;Grade&#039; will take you to the first student in the list so you can start grading individually. If you wish to grade several assignments, clicking Save and Show next will take you to the next submission.&lt;br /&gt;
&lt;br /&gt;
[[File:saveandshownext.png|center|thumb|400px]]&lt;br /&gt;
&lt;br /&gt;
Clicking &#039;View all submissions&#039; will take you to the grading table where you see all students.&lt;br /&gt;
&lt;br /&gt;
The Grading Table contains columns of information about the student, the status of their submission, a link to grade their submission, a link to each submission and feedback comments and files (if enabled). &lt;br /&gt;
&lt;br /&gt;
===Filtering submissions===&lt;br /&gt;
&lt;br /&gt;
A dropdown menu accessed from the &#039;Options&#039; section allows you to filter submissions so you can for example quickly see which students have not submitted yet.&lt;br /&gt;
&lt;br /&gt;
You can also filter submissions which have had extensions granted.&lt;br /&gt;
&lt;br /&gt;
[[File:filterassignments.png]]&lt;br /&gt;
&lt;br /&gt;
===Allocating submissions to markers===&lt;br /&gt;
If you need to divide submissions between more than one person, you can apply groups to the assignment and let markers know which group(s) to mark. Note that because group membership is not itself anonymised, this may make anonymised submissions that bit less anonymous, though as long as the groups aren&#039;t very small this should be acceptable.&lt;br /&gt;
&lt;br /&gt;
An alternative is to use [[Assignment_settings#Use_marking_allocation|marking allocation]] - this allows anyone with a teacher role to allocate one marker to each submission. This works particularly well if marking is allocated by subject specialism.&lt;br /&gt;
&lt;br /&gt;
===Submission status===&lt;br /&gt;
If you will be assigning grades to student work, you may want to take note of the submission status before you begin the marking process. If you have required students click the Submit button, you may find that some submissions are still marked as Draft (not submitted), meaning the student has either uploaded a file(s) or entered some text, but has not clicked ‘Submit assignment’. &lt;br /&gt;
&lt;br /&gt;
If it&#039;s after the due date and you are about to commencing marking that you use ‘Prevent submission changes’ to stop students from making changes to their assignment. You can do this one by one by using the icon in the Edit column.&lt;br /&gt;
&lt;br /&gt;
Or you can select two or more students by putting a tick in the select column and going to &#039;Lock submissions’ from the &#039;&#039;With selected&#039;&#039; menu under the grading table.&lt;br /&gt;
&lt;br /&gt;
Likewise you can also revert a student&#039;s submission to draft if they have uploaded the incorrect file. Instead of selecting ‘Prevent submission changes’ select ‘Revert the submission to draft’, or place ticks against selected students and choose &#039;Revert the submission to draft status&#039; from the &#039;&#039;With selected&#039;&#039; menu under the grading table.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:submission statuses.jpg|thumb|Submission statuses]]&lt;br /&gt;
|[[File:prevent submission changes dropdown.jpg|thumb|Prevent submission changes dropdown]]&lt;br /&gt;
|[[File:lock submissions.jpg|thumb|Lock submissions]]&lt;br /&gt;
|[[File:revert to draft.jpg|thumb|Revert to draft]]&lt;br /&gt;
|[[File:revert submission to draft status.jpg|thumb|Revert to draft status]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the submission setting &#039;Attempts reopened&#039; is set to &#039;Automatically until pass&#039; and a submission is graded below the grade to pass, then then submission is automatically unlocked when the grade is saved. Similarly, if the submission setting &#039;Attempts reopened&#039; is set to Manually, and a teacher selects &#039;Allow another attempt, then the submission is automatically unlocked. &lt;br /&gt;
&lt;br /&gt;
===Overriding assignment deadlines===&lt;br /&gt;
&lt;br /&gt;
A teacher can override a deadline for an individual or group from the Assignment navigation &amp;gt; More link [[Boost theme]] or Assignment administration other themes.) &lt;br /&gt;
&lt;br /&gt;
When adding overrides for a group, it is possible to have one group override trump another. This is achieved by moving the override up/down on the group overrides page:&lt;br /&gt;
&lt;br /&gt;
[[File:AssignGroupOverrides.png|||center]]&lt;br /&gt;
&lt;br /&gt;
In this situation, a student in both groups (e.g. Frodo Baggins) will have the override from &amp;quot;The Council of Elrond&amp;quot; applied. By pressing the arrow icons on the right, the override for &amp;quot;The Fellowship&amp;quot; can be moved to the top of the list, and will have higher precedence.&lt;br /&gt;
&lt;br /&gt;
Note also that if there exists a user override for a student, it will always take precedence over any group overrides.&lt;br /&gt;
&lt;br /&gt;
===Granting extensions===&lt;br /&gt;
If an assignment has a deadline, a teacher can grant individual or group assignment extensions by selecting the Edit link next to a particular student or group.&lt;br /&gt;
&lt;br /&gt;
#To grant an extension, open the assignment&lt;br /&gt;
#Click on &amp;quot;View all submissions&amp;quot;&lt;br /&gt;
#Locate the student who is to be allowed to submit after the &amp;quot;Cut-off date&amp;quot;To&lt;br /&gt;
#Click on the adjacent &amp;quot;Edit&amp;quot; drop down menu and select &amp;quot;Grant extension&amp;quot;&lt;br /&gt;
##[[File:grantextension0.png|thumb|center|600px]]&lt;br /&gt;
#Set the extension date and time. The student&#039;s or group&#039;s name is also shown on this screen.&lt;br /&gt;
##[[File:grantextension.png||thumb|center|600px]]&lt;br /&gt;
#Click on &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Quick grading===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quick grading&#039;&#039;&#039; allows you to enter numeric grades directly into the grading table, bypassing the more detailed grading interface. Please note:&lt;br /&gt;
*if you want to give feedback, you need to use the more detailed Grade interface. &lt;br /&gt;
*Quick grading is incompatible with advanced grading e.g. Rubrics, and is not recommended when there are multiple markers. &lt;br /&gt;
*&#039;&#039;&#039;Submission comments&#039;&#039;&#039; are a two-way private conversation between a student and staff and are visible to students immediately i.e. markers use the grading interface to give feedback, not the submission comments.&lt;br /&gt;
&lt;br /&gt;
To access the Quick Grading interface, from the Grading Summary page click &#039;View all submissions&#039;; the Grading Table displays. Scroll to bottom of the page to configure Options, and check the box for &#039;Quick grading&#039;. While you&#039;re down there, you can also set the number of assignments to display per page, filter the assignments e.g. to see who has not submitted, unmarked assignments, etc.&lt;br /&gt;
&lt;br /&gt;
When you are ready to Quick Grade: &lt;br /&gt;
&lt;br /&gt;
#You can enter grades directly into the grading table. &lt;br /&gt;
#Scroll to the bottom of the grading table and click &#039;Save all quick grading changes&#039;&lt;br /&gt;
#A confirmation displays.&lt;br /&gt;
&lt;br /&gt;
===Grading individual submissions===&lt;br /&gt;
If you have enabled File Feedback in the [[Assignment settings]] and wish to upload either the marked student assignment, a completed text based feedback document or audio feedback, click on the green tick in the Grade column (or use the icon in the Edit column and select Grade).&lt;br /&gt;
&lt;br /&gt;
This brings you to the Student Grading Page where you can give grades, feedback comments and feedback files (if enabled in the [[Assignment settings]]). You can use drag and drop to upload feedback files.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:green tick.jpg|thumb|Green tick]]&lt;br /&gt;
|[[File:grade.jpg|thumb|Grading]]&lt;br /&gt;
|[[File:feedbackfiles.png|thumb|Feedback files]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Annotating submissions====&lt;br /&gt;
&lt;br /&gt;
If the student has uploaded a PDF, docx or odt file, or if you set &#039;Comment inline&#039; for an online text submission, then their submission will be displayed on the grading screen, allowing you to annotate it (requires [http://www.ghostscript.com/ Ghostscript] for PDF and [[Universal Office Converter (unoconv)|unoconv]] for docx and odt files), using a variety of tools, stamps (if uploaded by the admin) and comments which may be saved to a comments bank. When the annotations are complete, clicking to save the changes will result in it being displayed to the student as part of their feedback. &lt;br /&gt;
&lt;br /&gt;
&#039;Rotate&#039; icons let you change the orientation of an uploaded document if the student submitted it in landscape mode for example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:AnnotatingAssignment.png|thumb|500px|center|Annotating a student&#039;s submission]]&lt;br /&gt;
&lt;br /&gt;
Comments may be added and then saved in a quick list for future use &#039;&#039;(1)&#039;&#039;  Click the paper/magnifying glass icon to the right of the page selector to filter comments you have already added to the work&#039;&#039;(2)&#039;&#039;:&lt;br /&gt;
*In the &#039;&#039;&#039;Search comments&#039;&#039;&#039; pop-up window, enter the term you would like to search for in the &#039;&#039;&#039;Filter comments...&#039;&#039;&#039; box. &lt;br /&gt;
*Clicking on the comment will take you to the part of the paper where that comment has been added.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:NFaddcomment.png|thumb|400px|1.Saving and re-using comments]]&lt;br /&gt;
|[[File:NFcommentsearch.png|thumb|400px|2. Accessing comments]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: To ensure that comments display to students as the marker intends, do instruct students to download the annotated PDF rather than just previewing it. Preview sometimes displays comments in a way which obscures the original text.&lt;br /&gt;
&lt;br /&gt;
The review panel and / or the grading panel may be collapsed by clicking the icons at the bottom right of the screen.&lt;br /&gt;
&lt;br /&gt;
[[File:CollapseReviewPanel.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Controlling when to notify students of graded work===&lt;br /&gt;
&lt;br /&gt;
====Notifying as you mark====&lt;br /&gt;
&lt;br /&gt;
If you need to notify individual students, one by one, as you mark, the &#039;&#039;&#039;Notify students&#039;&#039;&#039; checkbox is available when grading individual submissions. Choose Yes to notify the student immediately or No to grade without notifying the student. Assuming you are not hiding grades in the ways outlined below, then Moodle will send a notification.&lt;br /&gt;
&lt;br /&gt;
Note: How students receive Moodle notifications depends on your local default settings, and any changes students have made to those.&lt;br /&gt;
&lt;br /&gt;
[[File:notifystudents.png|center|thumb|500px]]&lt;br /&gt;
&lt;br /&gt;
====Keeping grades hidden until a release date====&lt;br /&gt;
&lt;br /&gt;
Assessors often decide to hide grades and feedback until marking is complete and finalised, and then release them all at once. There are two alternatives for this.  &lt;br /&gt;
&lt;br /&gt;
*[[Grade_hiding|Hide the item in the Grader Report]]. This is convenient if there are few markers and you have decided a provision date for releasing the marks and feedback. &lt;br /&gt;
*Or enable [[Assignment_settings#Use_marking_.28grading.29_workflow|Use marking workflow]] in the Assignment&#039;s settings. This way is best where there are many markers, and/or you don&#039;t have a provisional date to release marks and feedback.&lt;br /&gt;
&lt;br /&gt;
====Examples of Marking workflow====&lt;br /&gt;
&lt;br /&gt;
One marker, Marker, wants to release all grades at the same time &lt;br /&gt;
* Marker enables &amp;quot;Use marking workflow&amp;quot; &lt;br /&gt;
* Marker marks each submission and transitions the grading to &amp;quot;Marking completed&amp;quot; as each submission is graded. &lt;br /&gt;
* Marker then uses the batch operations to transition all grades to &amp;quot;Released&amp;quot; at the same time. &lt;br /&gt;
&lt;br /&gt;
Multiple markers, &lt;br /&gt;
* Marker enables &amp;quot;Use marking workflow&amp;quot; &lt;br /&gt;
* Marker marks each submission and transitions the grading to &amp;quot;Marking completed&amp;quot; as each submission is graded. &lt;br /&gt;
* Marker then uses the batch operations to transition all grades to &amp;quot;Released&amp;quot; at the same time.&lt;br /&gt;
&lt;br /&gt;
===Offline marking - downloading and uploading multiple grades and feedback files===&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have an internet connection or prefer to grade outside Moodle, you can do so (including with anonymous submissions).&lt;br /&gt;
These easy stages explained below:&lt;br /&gt;
#Download the submissions&lt;br /&gt;
#Download the spreadsheet (grading worksheet) to record grades.&lt;br /&gt;
#Grade and annotate (if applicable) the submitted work.&lt;br /&gt;
#Upload the completed grading worksheet.&lt;br /&gt;
#Upload the annotated submissions (if applicable).&lt;br /&gt;
&lt;br /&gt;
Note:You cannot upload marks and feedback to Moodle if you have enabled Rubrics or Marking Guides.&lt;br /&gt;
&lt;br /&gt;
====Before you start, enable the multiple file upload settings====&lt;br /&gt;
Go to the settings of that assignment.&lt;br /&gt;
For Feedback types, ensure that the Moodle Assignment settings, Feedback comments, Feedback files, and Offline grading worksheet are ticked. &lt;br /&gt;
&lt;br /&gt;
====Downloading student submissions====&lt;br /&gt;
&lt;br /&gt;
You can download a zip file containing all of the assignment submissions by selecting ‘Download all submissions’ from the &#039;Grading actions&#039; menu at the top of the grading table, or in the settings menu. &lt;br /&gt;
&lt;br /&gt;
File submissions will be downloaded in the format uploaded by the student. Online text submissions will be downloaded as html files. Each file in the zip will be named with the student first and last name followed by a unique identifier (not the user ID number).&lt;br /&gt;
&lt;br /&gt;
If each submission is more than a single file, then submissions may be downloaded in folders by ticking the option &#039;Download submissions in folders&#039; (below the grading table). Each submission is put in a separate folder, with the folder structure kept for any subfolders, and files are not renamed. Each folder will be named with the student first and last name followed by a unique identifier (not the user ID number).&lt;br /&gt;
&lt;br /&gt;
You can also download selected assignment submissions (rather than all of them) by selecting the ones you want and then choosing &#039;With selected....Download selected submissions&#039;.&lt;br /&gt;
&lt;br /&gt;
====Download the Grading Worksheet to record grades ====&lt;br /&gt;
#Next, to download the spreadsheet in which you&#039;ll enter the grades and brief comments, return to the Moodle Assignment page and from its Grading action drop-down menu choose Download grading worksheet and save that file (keep its csv file format).&lt;br /&gt;
&lt;br /&gt;
Note: Helpfully that downloaded worksheet will contain any existing grades and summary comments which have already been given for that assignment i.e. if marking has already started. However, to see pre-existing comments fully you may need to set your spreadsheet to &#039;wrap text&#039; within cells.&lt;br /&gt;
&lt;br /&gt;
====Grade and annotate (if applicable) the submitted work====&lt;br /&gt;
After downloading the submissions and the grading worksheet:&lt;br /&gt;
#Open a downloaded assignment file to assess it. &lt;br /&gt;
#Open the csv file in a spreadsheet editor e.g. Excel. &lt;br /&gt;
#For that student&#039;s record (if anonymous, a number corresponding to the submission file name will display), enter grades in the Grade column and summary comments in the Feedback comments column for each student. &lt;br /&gt;
#Leave the other data untouched unless you know exactly what you&#039;re doing.&lt;br /&gt;
#Repeat as needed.&lt;br /&gt;
#Save the csv file.&lt;br /&gt;
&lt;br /&gt;
Note: Take care to enter data in the correct column of the spreadsheet.&lt;br /&gt;
&lt;br /&gt;
If you are annotating the submissions to return to students as feedback:&lt;br /&gt;
#Open a downloaded submission.&lt;br /&gt;
#Carry out your annotations.&lt;br /&gt;
#Save it in its original place i.e. the folder corresponding to that student.&lt;br /&gt;
#Repeat as needed.&lt;br /&gt;
If you have separate feedback files to upload to students:&lt;br /&gt;
#Save these within that student&#039;s folder.&lt;br /&gt;
#You can give students multiple feedback files in this way e.g. annotations on their work along with a separate pro forma.&lt;br /&gt;
&lt;br /&gt;
Note: Don&#039;t change the name or location of the folder - Moodle needs this information to allocate the files correctly.&lt;br /&gt;
&lt;br /&gt;
Compress (zip) all the feedback files:&lt;br /&gt;
&lt;br /&gt;
#Locate the folder containing the feedback files in Moodle, select them all (Ctrl+A within the folder), then zip them: &lt;br /&gt;
##Windows: Right click one of the selected files and Send to &amp;gt; Compressed (zipped) folder.&lt;br /&gt;
##Mac: Right Click (or Ctrl+click) one of the selected files and click Compress.&lt;br /&gt;
#They are now ready for upload (see below).&lt;br /&gt;
&lt;br /&gt;
====Upload the completed grading worksheet====&lt;br /&gt;
When you are ready to upload grades and summary feedback:&lt;br /&gt;
#Click on the assignment name on the Moodle course homepage to access the summary page and click &#039;&#039;&#039;View/grade all submissions&#039;&#039;&#039;.&lt;br /&gt;
#From the Grading action drop-down menu choose &#039;&#039;&#039;Upload grading worksheet&#039;&#039;&#039;.&lt;br /&gt;
#Click &#039;&#039;&#039;Choose a file...&#039;&#039;&#039; and upload the grading worksheet to Moodle, or drag the csv file to the arrow and wait for the file name to appear in the box.&lt;br /&gt;
#There is a checkbox to &#039;&#039;&#039;overwrite records that have been modified more recently in Moodle than in the spreadsheet&#039;&#039;&#039; - only check this if you want to spreadsheet to overwrite all Moodle records, including ones made more recently than the spreadsheet.&lt;br /&gt;
#Click &#039;&#039;&#039;Upload grading worksheet&#039;&#039;&#039;; a Confirmation box displays the students grades and feedback that will be imported - check this carefully.&lt;br /&gt;
#If you are ready to proceed, click &#039;&#039;&#039;Confirm&#039;&#039;&#039;; a summary of updates displays.&lt;br /&gt;
#Click &#039;&#039;&#039;Continue&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====Upload feedback files (if applicable)====&lt;br /&gt;
#Click on the assignment name on the Moodle course homepage to access the summary page and click &#039;&#039;&#039;View/grade all submissions&#039;&#039;&#039;.&lt;br /&gt;
#From the Grading action drop-down menu choose &#039;&#039;&#039;Upload multiple feedback files in a zip&#039;&#039;&#039;.&lt;br /&gt;
#Click &#039;&#039;&#039;Choose a file...&#039;&#039;&#039; and upload the zipped assignments file to Moodle, or drag the compressed/zipped file to the arrow and wait for the file name to appear in the box.&lt;br /&gt;
#Click &#039;&#039;&#039;Import feedback file(s)&#039;&#039;&#039;.&lt;br /&gt;
#The Confirmation box will list all the feedback files and student names that will be imported.&lt;br /&gt;
#Click &#039;&#039;&#039;Confirm&#039;&#039;&#039;; the next screen summarises the changes.&lt;br /&gt;
#Click &#039;&#039;&#039;Continue&#039;&#039;&#039;﻿.&lt;br /&gt;
#From the page containing the Grading Table, you can check your feedback files by enabling Quick grading (see Options at the bottom of that page) and scrolling horizontally, if needed.&lt;br /&gt;
&lt;br /&gt;
For an assignment with no file submissions, see the discussion [https://moodle.org/mod/forum/discuss.php?d=336438 upload feedback files without student file submissions] for details of what to do.&lt;br /&gt;
&lt;br /&gt;
===Give the same feedback file to multiple students===&lt;br /&gt;
If you have high level feedback you want to give to an entire cohort, it is generally a good idea to give this feedback in the context of the assignment, rather than e.g. separately via a Forum. Moodle allows you to select some or all students and attach a single, common feedback file to their assignment feedback. This common feedback will appear to each student along with any other individual feedback files you have prepared for each. &lt;br /&gt;
#Prepare the single file of feedback.&lt;br /&gt;
#Click on the link to the Assignment; its summary page displays.&lt;br /&gt;
#Click &#039;&#039;&#039;View all submissions&#039;&#039;&#039;; the assignment&#039;s Grading Table displays.&lt;br /&gt;
#Use the checkboxes to select all or some students to receive the feedback (you may first prefer to configure the Grading Table to show as many students as possible on a single page).&lt;br /&gt;
#Underneath the Grading Table click the &#039;&#039;&#039;With selected...&#039;&#039;&#039; menu, choose &#039;&#039;&#039;Send feedback files&#039;&#039;&#039;, then click &#039;&#039;&#039;Go&#039;&#039;&#039;; a page displays a list of selected students above a file upload area.&lt;br /&gt;
#Upload the file of feedback you prepapred, or drag it to the arrow and wait for the file name to appear in the box.&lt;br /&gt;
#Click &#039;&#039;&#039;Send feedback files&#039;&#039;&#039;; the Grading Table displays again.&lt;br /&gt;
#Check your file is in place by scrolling horizontally to the &#039;&#039;&#039;Feedback files&#039;&#039;&#039; column.&lt;br /&gt;
&lt;br /&gt;
==Keeping records (archiving, exporting, backing up)==&lt;br /&gt;
When students unenrol from a Moodle area, their records become invisible through the Gradebook interface. In order to have the information to hand, departments or course teaching teams may need systems in place to keep their own records for the data retention period required in their particular context. There are two separate procedures for exporting student submissions and marks.&lt;br /&gt;
&lt;br /&gt;
To export marks (with or without feedback):&lt;br /&gt;
#Go to your course administration block and click Grades.&lt;br /&gt;
#From the Grader Report Settings block, select Export; a menu displays.&lt;br /&gt;
#From the menu, if you need easy viewing and running calculations you probably want to select one of the spreadsheet formats; a page of export settings loads&lt;br /&gt;
#Use the Visible Groups pulldown menu to limit the export to specific groups, as required&lt;br /&gt;
#In Options, you indicate whether feedback comments are included&lt;br /&gt;
#In Grade Items To Be Included lists you can, if required, omit particular Activities from the report&lt;br /&gt;
#When you&#039;ve finished with the settings, click on Submit; a preview of your export displays&lt;br /&gt;
#Click on Download to export to the format you chose, and save the file.&lt;br /&gt;
&lt;br /&gt;
To download the original student submissions:&lt;br /&gt;
#In your course area, click the link to the Assignment whose submissions you want to download.&lt;br /&gt;
#Click on the link to View/Grade all submissions; the Grading Table will load.&lt;br /&gt;
#Click the link to &#039;Download all submissions&#039; and save the file.&lt;br /&gt;
==Tips and Tricks==&lt;br /&gt;
* Want to use an Assignment activity again in another Moodle site? Use the [[Activity_backup| backup  and restore]] options.  &lt;br /&gt;
*Want to use an Assignment activity in another course you teach?  Use the [[Import_course_data| Import function]] in the course administration block.&lt;br /&gt;
*Moodle will sometimes appear not to be uploading a resubmitted assignment - you seem to be downloading the original assignment. This is a cache issue, in short, go to &#039;&#039;&amp;quot;Tools &amp;gt; Clear Recent History&amp;quot;&#039;&#039; in Firefox or &#039;&#039;&amp;quot;Tools &amp;gt; Delete Browsing History &amp;gt; Delete Temporary Files&amp;quot;&#039;&#039; in Windows Explorer. The newer file will then appear.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
===Examples from [https://school.moodledemo.net School demo site]===&lt;br /&gt;
&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=573&amp;amp;rownum=3&amp;amp;action=grade Teacher view of a PDF assignment which can  be annotated inline.]Log in with username &#039;teacher&#039; and password &#039;moodle&#039;&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=573&amp;amp;action=grading Teacher view of allocated markers and marking workflow status.] Log in with username &#039;teacher&#039; and password &#039;moodle&#039;&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=190 Student view of an assignment.] Log in with username &#039;student&#039; and password &#039;moodle&#039;. Scroll down to see the rubric and feedback.&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=46&amp;amp;action=editsubmission Student view of a student submission statement] Log in with username &#039;student&#039; and password &#039;moodle&#039;&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=715 Student view of group assignment grading screen] Log in with username &#039;student&#039; and password &#039;moodle&#039;&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=715&amp;amp;action=grading Teacher view of a group assignment grading screen] Log in with username &#039;teacher&#039; and password &#039;moodle&#039;.&lt;br /&gt;
* [https://school.moodledemo.net/mod/assign/view.php?id=191&amp;amp;action=grading Teacher view of Anonymous submissions grading screen] Log in with username &#039;teacher&#039; and password &#039;moodle&#039;&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [http://www.somerandomthoughts.com/blog/2013/07/07/one-approach-for-group-project-grading/ One approach to group project grading] blog post by Gavin Henrick&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=201307 Advantages of using Assignment upload over emailing a document] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[de:Aufgabe nutzen]]&lt;br /&gt;
[[fr:Afficher un devoir]]&lt;br /&gt;
[[ja:課題を表示する]]&lt;br /&gt;
[[es:Usando Tarea]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=RedHat_Linux_installation&amp;diff=146043</id>
		<title>RedHat Linux installation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=RedHat_Linux_installation&amp;diff=146043"/>
		<updated>2023-04-28T16:32:36Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* SELinux */ Added details prompted by https://moodle.org/mod/forum/discuss.php?d=446229&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Update}}&lt;br /&gt;
&lt;br /&gt;
== Server Installation ==&lt;br /&gt;
* Web Server&lt;br /&gt;
** Moodle 3.7 needs PHP 7.1; RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]&lt;br /&gt;
* Database&lt;br /&gt;
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6; RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/deploying_different_types_of_servers/index#using-mariadb]&lt;br /&gt;
* BEWARE OF the &#039;Server with a GUI&#039; option, it may not work as expected.&lt;br /&gt;
&lt;br /&gt;
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.&lt;br /&gt;
&lt;br /&gt;
== Network Interface ==&lt;br /&gt;
&lt;br /&gt;
During installation, under &amp;quot;System&amp;quot; -&amp;gt; &amp;quot;Network &amp;amp; Host Name&amp;quot;, remember to enable the NIC. It&#039;s not enabled by default.&lt;br /&gt;
&lt;br /&gt;
== Configure hostname and domain name==&lt;br /&gt;
&lt;br /&gt;
Type system-config-network to open the GUI editor.  Click on the DNS tab. In the &amp;quot;DNS Search Path&amp;quot; fill in your domain name for example myuniversity.edu. Now ensure the &amp;quot;Hostname&amp;quot; contains the computer name you will use and click activate to make changes&lt;br /&gt;
&lt;br /&gt;
== System Registration ==&lt;br /&gt;
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/&lt;br /&gt;
* Subscribe the system by:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
subscription-manager register --auto-attach&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter the username and password as requested.&lt;br /&gt;
* Update the system and then reboot&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum update&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]&lt;br /&gt;
&lt;br /&gt;
== SELinux ==&lt;br /&gt;
By default Red Hat Enterprise Linux comes with SELinux set to &#039;enforcing&#039;. This may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem.&lt;br /&gt;
&lt;br /&gt;
If you are not used to SELinux and setting permissions, it&#039;s (maybe less secure but) often easier to lower the SELinux level to &#039;permissive&#039; or even &#039;disabled&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vi /etc/sysconfig/selinux&lt;br /&gt;
&lt;br /&gt;
SELINUX=disabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]&lt;br /&gt;
&lt;br /&gt;
=== Moodledata ===&lt;br /&gt;
&lt;br /&gt;
To allow writing to the Moodledata directory run the following commands after creating the directory (assuming your Moodledata directory is in &#039;&#039;&#039;/var/www/moodle.example.com/moodledata&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 # semanage fcontext -a -t httpd_sys_rw_content_t &amp;quot;/var/www/moodle.example.com/moodledata&amp;quot;&lt;br /&gt;
 # restorecon -v &amp;quot;/var/www/moodle.example.com/moodledata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the Moodledata directory already exists and is not empty instead run:&lt;br /&gt;
&lt;br /&gt;
 # semanage fcontext -a -t httpd_sys_rw_content_t &amp;quot;/var/www/moodle.example.com/moodledata(/.*)?&amp;quot;&lt;br /&gt;
 # restorecon -R -v &amp;quot;/var/www/moodle.example.com/moodledata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Access to network services ===&lt;br /&gt;
&lt;br /&gt;
If your Moodle site needs access to remote network services then you must allow this access with:&lt;br /&gt;
&lt;br /&gt;
 # setsebool -P httpd_can_network_connect 1&lt;br /&gt;
&lt;br /&gt;
This is required if your Moodle database is remote, or if you are using a network service such as LDAP (auth_ldap or enrol_ldap), or some external database (auth_db or enrol_database). This is not required if your Moodle database is a local MySQL/MariaDB database, but is required if your Moodle database is a local PostgreSQL database.&lt;br /&gt;
&lt;br /&gt;
=== Access to execute commands ===&lt;br /&gt;
&lt;br /&gt;
To run commands such as those specified under [[System_paths|System paths]]:&lt;br /&gt;
&lt;br /&gt;
 # setsebool -P httpd_execmem on&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
The internal firewall (RHEL since version 7 uses &#039;firewalld&#039;[https://firewalld.org/]) is on by default. It will block the access to the web server. You may stop it first to test connection:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service firewalld stop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then either disable it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chkconfig firewalld off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or enable permanent HTTP access to it, you may want to enable HTTPS as well:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
firewall-cmd --permanent --zone=public --add-service=http&lt;br /&gt;
firewall-cmd --permanent --zone=public --add-service=https&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the firewall and then check the allow status:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service firewalld restart&lt;br /&gt;
firewall-cmd --zone=public --list-services&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To disable certain types of ICMP traffic [http://www.freekb.net/Article?id=2639], e.g. timestamp request and reply:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
firewall-cmd --add-icmp-block=timestamp-request --permanent&lt;br /&gt;
firewall-cmd --add-icmp-block=timestamp-reply --permanent&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the firewall and then check the block status:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
firewall-cmd --reload&lt;br /&gt;
firewall-cmd --query-icmp-block=timestamp-request&lt;br /&gt;
firewall-cmd --query-icmp-block=timestamp-reply&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]&lt;br /&gt;
&lt;br /&gt;
== MariaDB / MySQL ==&lt;br /&gt;
&lt;br /&gt;
* Make sure at least &#039;mariadb&#039; and &#039;mariadb-server&#039; packages are installed.&lt;br /&gt;
** (use &amp;quot;mysql&amp;quot; and &amp;quot;mysql-server&amp;quot; for MySQL)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install mariadb mariadb-server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]&lt;br /&gt;
** (use &amp;quot;mysqld&amp;quot; for MySQL)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service mariadb start; chkconfig mariadb on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn&#039;t need this as these are already the default settings.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;vi /etc/my.cnf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Scroll down to the [mysqld] section and under &amp;quot;Basic Settings&amp;quot;, add the following line under the last statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;innodb_file_format = Barracuda&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;innodb_file_per_table = 1&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;innodb_large_prefix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you haven&#039;t yet, as root, change the MariaDB/MySQL root password, also secure the installation&lt;br /&gt;
** mysql_secure_installation&lt;br /&gt;
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)&lt;br /&gt;
* Launch MariaDB/MySQL as root&lt;br /&gt;
** mysql -u root -p&lt;br /&gt;
*** (at the password prompt, enter the password from above)&lt;br /&gt;
* At the &#039;&amp;gt;&#039; MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a &#039;;&#039;)&lt;br /&gt;
** CREATE DATABASE mymoodle CHARSET &#039;utf8mb4&#039;;&lt;br /&gt;
*** (&#039;mymoodle&#039; is the name of the database you would like to use, it will be entered to the Moodle &#039;config.php&#039; later)&lt;br /&gt;
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY &#039;moodlepass&#039;;&lt;br /&gt;
*** (as above, &#039;mymoodle&#039;, &#039;moodleuser&#039; and &#039;moodlepass&#039; will be entered to the Moodle &#039;config.php&#039; later)&lt;br /&gt;
** flush privileges;&lt;br /&gt;
** quit&lt;br /&gt;
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don&#039;t have too much to worry about.)&lt;br /&gt;
&lt;br /&gt;
== Setup Moodle ==&lt;br /&gt;
(I will install under /usr/moodle, data in /usr/moodle_data)&lt;br /&gt;
&lt;br /&gt;
=== Download ===&lt;br /&gt;
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)&lt;br /&gt;
* as Root create folder under /usr and copy zip&lt;br /&gt;
** su&lt;br /&gt;
** mkdir /usr/moodle&lt;br /&gt;
** mkdir /usr/moodle_data&lt;br /&gt;
** cp moodle_111.zip /usr/moodle&lt;br /&gt;
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/400/en/Git_for_Administrators Git_for_Administrators] for details.&lt;br /&gt;
** cd /usr&lt;br /&gt;
** git clone git://git.moodle.org/moodle.git&lt;br /&gt;
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.&lt;br /&gt;
** cd /usr/moodle&lt;br /&gt;
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login&lt;br /&gt;
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle&lt;br /&gt;
&lt;br /&gt;
=== Unpack and set file permission etc ===&lt;br /&gt;
&lt;br /&gt;
* Still as root we unpack moodle and rename to something appropriate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.&lt;br /&gt;
** cd /usr/moodle&lt;br /&gt;
** unzip moodle_xxx.zip&lt;br /&gt;
** mv moodle mymoodle&lt;br /&gt;
*** (optional step - I have more than one install under /usr/moodle)&lt;br /&gt;
** mkdir /usr/moodle_data/mymoodle&lt;br /&gt;
*** (same name as the moodle install above)&lt;br /&gt;
** chown -R apache:apache /usr/moodle&lt;br /&gt;
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recommendations on how to secure a production environment.)&lt;br /&gt;
** chown -R apache:apache /usr/moodle_data&lt;br /&gt;
&lt;br /&gt;
=== Setup config.php ===&lt;br /&gt;
&lt;br /&gt;
* Still as root copy and edit the config file, you should know the host/domain name for your server&lt;br /&gt;
** cd /usr/moodle/mymoodle&lt;br /&gt;
** cp config-dist.php config.php&lt;br /&gt;
** vi config.php (or whatever your favourite editor is!)&lt;br /&gt;
* Your config.php settings should be something like...&lt;br /&gt;
** dbtype = &#039;mariadb&#039; (use &#039;mysqli&#039; for MySQL)&lt;br /&gt;
** dbhost = &#039;localhost&#039;&lt;br /&gt;
** dbname = &#039;mymoodle&#039;&lt;br /&gt;
** dbuser = &#039;moodleuser&#039;&lt;br /&gt;
** dbpass = &#039;moodlepass&#039; (&amp;lt;-- better make this something of your own)&lt;br /&gt;
** prefix = &#039;mdl_&#039;&lt;br /&gt;
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)&lt;br /&gt;
** wwwroot = &#039;http://myhost.mydomain&#039;&lt;br /&gt;
*** (If you only want to try moodle out and will not be accessing it from other machines you can use &#039;http://localhost/mymoodle&#039;)&lt;br /&gt;
** dataroot = &#039;/usr/moodle_data/mymoodle&#039;&lt;br /&gt;
* Save your changes and exit from the editor&lt;br /&gt;
&lt;br /&gt;
== Apache ==&lt;br /&gt;
* Install it if it&#039;s not installed already.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install httpd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or everything&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install httpd*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Start it and make it auto-start after reboot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service httpd start; chkconfig httpd on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.&lt;br /&gt;
* Edit the Apache configuration file &amp;lt;pre&amp;gt;/etc/httpd/conf/httpd.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Right at the end of the file add the following lines:&lt;br /&gt;
** &amp;lt;Directory &amp;quot;/usr/moodle/mymoodle&amp;quot;&amp;gt; (the directory used during Moodle installation)&lt;br /&gt;
** DirectoryIndex index.php&lt;br /&gt;
** AcceptPathInfo on&lt;br /&gt;
** AllowOverride None&lt;br /&gt;
** Options None&lt;br /&gt;
** Order allow,deny&lt;br /&gt;
** Allow from all&lt;br /&gt;
** &amp;lt;/Directory&amp;gt;&lt;br /&gt;
** Alias /mymoodle &amp;quot;/usr/moodle/mymoodle&amp;quot;&lt;br /&gt;
* Don&#039;t insert a space in &amp;quot;allow,deny&amp;quot; (common mistake!)&lt;br /&gt;
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.&lt;br /&gt;
* Run the Services application (same as for Mysql) - tick and start &amp;quot;httpd&amp;quot;, then save changes and exit.&lt;br /&gt;
&lt;br /&gt;
=== Setting Document Root ===&lt;br /&gt;
Edit &amp;lt;pre&amp;gt;/etc/httpd/conf/httpd.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change From: DocumentRoot /var/www/html&lt;br /&gt;
&lt;br /&gt;
Change To: DocumentRoot /var/www/html/mymoodle&lt;br /&gt;
&lt;br /&gt;
If you want the web site to be served as &amp;quot;http://www.whatever.com/mymoodle&amp;quot; instead of &amp;quot;http://www.whatever.com&amp;quot;, don&#039;t change it, and modify the &#039;wwwroot&#039; parameter of Moodle &#039;config.php&#039; file accordingly.&lt;br /&gt;
&lt;br /&gt;
== PHP ==&lt;br /&gt;
* Install PHP:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Check the installed PHP version:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# php -v&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Restart the web server so that PHP can start working:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service httpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a &amp;quot;phpinfo.php&amp;quot; file within the &amp;quot;/var/www/html&amp;quot; directory (or anywhere the Apache &amp;quot;DocumentRoot&amp;quot; points to) with the following content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then open web browser and browse to &amp;quot;http://webserver/phpinfo.php&amp;quot; to make sure PHP is working with the web server. Then remove the file for security reason.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--RedHat EL - or &#039;the upstream vendor&#039; if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.&lt;br /&gt;
&lt;br /&gt;
You have therefore to make a choice:&lt;br /&gt;
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own&lt;br /&gt;
* Install the whole (latest) PHP from source on your own (and maintain it)&lt;br /&gt;
* Install PHP packages from a third party repo (but you won&#039;t get support from Redhat if you run into problems):&lt;br /&gt;
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)&lt;br /&gt;
** RPMFusion and others also have newer PHP packages--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Moodle ==&lt;br /&gt;
Now everything&#039;s ready. Use web browser to open &amp;quot;http://webserver/mymoodle/install.php&amp;quot; to start the installation.&lt;br /&gt;
&lt;br /&gt;
== Set up cron job ==&lt;br /&gt;
&lt;br /&gt;
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user&#039;s &amp;quot;personal&amp;quot; crontab (don&#039;t do both!).&lt;br /&gt;
===CLI version===&lt;br /&gt;
{{Note| According to Moodle&#039;s documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}&lt;br /&gt;
&lt;br /&gt;
* If you wish to place an entry in your root user&#039;s crontab use:&lt;br /&gt;
** &amp;lt;pre&amp;gt;crontab -e&amp;lt;/pre&amp;gt;&lt;br /&gt;
** Add the following line:&lt;br /&gt;
&amp;lt;pre&amp;gt; */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php&amp;lt;/pre&amp;gt;&lt;br /&gt;
to run the command every 5 minutes.&lt;br /&gt;
&lt;br /&gt;
===Web version===&lt;br /&gt;
{{Note|Use the CLI version if possible.}}&lt;br /&gt;
* If you wish to place an entry in your root user&#039;s crontab use:&lt;br /&gt;
** crontab -e&lt;br /&gt;
** Add the following line:&lt;br /&gt;
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php&lt;br /&gt;
**** (change the URL as appropriate for your site)&lt;br /&gt;
---&lt;br /&gt;
* If you wish to add an entry in /etc/crontab:&lt;br /&gt;
* Open the /etc/crontab file in an editor (vi).&lt;br /&gt;
* Add the following line:&lt;br /&gt;
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php&lt;br /&gt;
*** (change the URL as appropriate for your site)&lt;br /&gt;
---&lt;br /&gt;
* In either case, don&#039;t forget to save the file and exit (in vi that is &amp;lt;Esc&amp;gt;, then &#039;:wq&#039;)&lt;br /&gt;
&lt;br /&gt;
== Try your new installation ==&lt;br /&gt;
&lt;br /&gt;
http://myhost.mydomain/admin&lt;br /&gt;
or&lt;br /&gt;
http://myhost.mydomain/mymoodle/admin&lt;br /&gt;
&lt;br /&gt;
or, if you are running the browser on the same machine&lt;br /&gt;
&lt;br /&gt;
http://localhost/admin&lt;br /&gt;
or&lt;br /&gt;
http://localhost/mymoodle/admin&lt;br /&gt;
&lt;br /&gt;
== Installing SSL certificate ==&lt;br /&gt;
&lt;br /&gt;
After installing the SSL certificate, change the &#039;http&#039; to &#039;https&#039; in the &#039;wwwroot&#039; parameter of Moodle &#039;config.php&#039; file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[pl:Instalacja w RedHat]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Unix or Linux Installation]]&lt;br /&gt;
*[[Installing Moodle]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=course/view/onetopic&amp;diff=145719</id>
		<title>course/view/onetopic</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=course/view/onetopic&amp;diff=145719"/>
		<updated>2023-03-22T10:28:08Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Add redirect for format_onetopic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[Course homepage]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Grade_history&amp;diff=145624</id>
		<title>Grade history</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Grade_history&amp;diff=145624"/>
		<updated>2023-03-06T19:08:23Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Disabling grade history */ Spelling/grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Managing grades}}&lt;br /&gt;
==What is Grade history?==&lt;br /&gt;
&lt;br /&gt;
Accessed from &#039;&#039;Course administration &amp;gt; Grade administration &amp;gt; Grade history,&#039;&#039; the Grade history report allows teachers to select specific students, grade items and/or graders and view the grading history for certain dates.&lt;br /&gt;
&lt;br /&gt;
It is possible to view only revised grades and to download the data in various format such as .csv or an  Excel/Libre Office spreadsheet.&lt;br /&gt;
&lt;br /&gt;
[[File:fbgradehistory.png|thumb|600px|center]]&lt;br /&gt;
&lt;br /&gt;
===Grader===&lt;br /&gt;
&lt;br /&gt;
Note: If your course contains quizzes or workshops, then you will see your students listed in the &#039;Grader&#039; dropdown. This is expected as they are graders in a workshop and self-grade in a quiz.&lt;br /&gt;
&lt;br /&gt;
==Site administration settings==&lt;br /&gt;
The administrator can decide how many history entries will be displayed per page in the Grade history report by specifying a number in &#039;&#039;Site adminstration &amp;gt; Grades &amp;gt; Report settings &amp;gt; Grade history.&#039;&#039; The default is 50.&lt;br /&gt;
===Disabling grade history===&lt;br /&gt;
Grade history may be disabled, or the history only kept for a specified period, by editing the settings in &#039;&#039;Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;. Disabling grade history may speed up the server a little and conserve space in the database.&lt;br /&gt;
&lt;br /&gt;
[[es:Historia de la calificación]]&lt;br /&gt;
[[de:Bewertungsverlauf]]&lt;br /&gt;
[[fr:Historique d&#039;évaluation]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=File_resource_FAQ&amp;diff=145621</id>
		<title>File resource FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=File_resource_FAQ&amp;diff=145621"/>
		<updated>2023-03-06T11:13:42Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* I&amp;#039;ve uploaded a video file, but it&amp;#039;s too small. How do I change the default video size? */ Change code to syntaxhighlight; x to ×&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}&lt;br /&gt;
==I can&#039;t upload files to my course.I get the message that my &#039;filetype cannot be accepted&#039;==&lt;br /&gt;
*Make sure you are not trying to upload to the course summary files area - &#039;&#039;Administration&amp;gt;Course administration&amp;gt;Edit settings.&#039;&#039;&lt;br /&gt;
*This upload area is only for files describing the course and by default only image files are allowed (so that a screenshot may be displayed next to the summary.)&lt;br /&gt;
*If you wish to upload files into your course, make sure you are first on the main course page itself, not in the settings of the course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==My students cannot open the file I uploaded for them==&lt;br /&gt;
Check that the students have the appropriate software to open your file. While Moodle will accept different types of files, it relies on the user to read them with the relevant program. If you uploaded a MS Word 2010 document for instance, make sure your class is able to access Office 2010, or provide them with alternatives such as links to Open Office, a &amp;quot;reader&amp;quot; or a pdf version of your file. If your teaching involves the use of subject-specific proprietary software, you should ensure your students are given the means to open the files at home as well as in your establishment.&lt;br /&gt;
&lt;br /&gt;
See the [https://moodle.org/plugins/search.php?s=Power&amp;amp;p=1&amp;amp;l=20&amp;amp;o=263 existing additional plugins ] for opening PowerPoint and other MS Office files within Moodle.&lt;br /&gt;
&lt;br /&gt;
See the [[Working_with_files#Alternative_to_MS_PowerPoint_and_PDF_files| Presentation]] additional plugin that displays multimedia HTML5 presentations and slide shows in users&#039; web browsers.&lt;br /&gt;
&lt;br /&gt;
==Office docs and PDFs won&#039;t open on Android devices==&lt;br /&gt;
Try changing the display to &amp;quot;Automatic&amp;quot; instead of &amp;quot;Force download&amp;quot;. See this [https://moodle.org/mod/forum/discuss.php?d=271372#p1169372  forum post about documents and Android mobiles].&lt;br /&gt;
&lt;br /&gt;
==Why is it possible to select multiple files in the file settings?==&lt;br /&gt;
&lt;br /&gt;
Because you might be uploading a set of HTML pages with resources. You make the index.HTML page the main one, and can reference the other resources.&lt;br /&gt;
&lt;br /&gt;
==How can I upload a lot of files in one go?==&lt;br /&gt;
&lt;br /&gt;
You can use the [[Folder]] resource to display multiple files. Put all your files into  a folder, zip(compress) the folder and upload it to the [[Folder]] resource. Click the icon to the right of its name to unzip it and then save. All the files will then display.&lt;br /&gt;
&lt;br /&gt;
==How can I change the top frame size when displaying a file in a frame?==&lt;br /&gt;
&lt;br /&gt;
#Login as an admin and go to &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; File&#039;&#039;.&lt;br /&gt;
#Change the &#039;Frame height&#039; setting.&lt;br /&gt;
#Click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
==If I upload a file in one course, can I use it in another course as well?==&lt;br /&gt;
Yes. From the file picker, choose Server files and then navigate to the course where you  uploaded the file initially and select it there.&lt;br /&gt;
&lt;br /&gt;
==How can I make ppt files open within Moodle rather than downloading?==&lt;br /&gt;
&lt;br /&gt;
You need to convert the ppt to something else, such as PDF.&lt;br /&gt;
&lt;br /&gt;
==How can I show the size of a file on the course page?==&lt;br /&gt;
&lt;br /&gt;
Students who need to download files appreciate being able to see its size especially if they have a slow Internet connection. Simply tick the &#039;Show size&#039; checkbox in the file settings.&lt;br /&gt;
&lt;br /&gt;
==If students can link to uploaded files as aliases, how can I stop them changing their assignments?==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry! Students are not allowed to link to files in their private files when uploading assignments, forum attachments, workshop submissions or quiz essays. See [[Working with files]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==I&#039;ve uploaded a video file, but it&#039;s too small. How do I change the default video size?==&lt;br /&gt;
&lt;br /&gt;
The default size for Moodle video and flash replay is 400×300 pixels. If you want the default video size to be larger, add the following code to your config.php file.  Another method is to add the same code to the bottom of theme/themename/config.php file (where themename is the name of the theme or themes you are using). Note set the number to the size in pixels you want, common sizes being 800×600 or 700×525 or 600×450 or 500×375.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;... if (!defined(&#039;CORE_MEDIA_VIDEO_WIDTH&#039;)) {&lt;br /&gt;
    // Default video width if no width is specified; some players may do something&lt;br /&gt;
    // more intelligent such as use real video width.&lt;br /&gt;
    // May be defined in config.php if required.&lt;br /&gt;
    define(&#039;CORE_MEDIA_VIDEO_WIDTH&#039;, 800);&lt;br /&gt;
}&lt;br /&gt;
if (!defined(&#039;CORE_MEDIA_VIDEO_HEIGHT&#039;)) {&lt;br /&gt;
    // Default video height. May be defined in config.php if required.&lt;br /&gt;
    define(&#039;CORE_MEDIA_VIDEO_HEIGHT&#039;, 600);&lt;br /&gt;
}&lt;br /&gt;
if (!defined(&#039;CORE_MEDIA_AUDIO_WIDTH&#039;)) {&lt;br /&gt;
    // Default audio width if no width is specified.&lt;br /&gt;
    // May be defined in config.php if required.&lt;br /&gt;
    define(&#039;CORE_MEDIA_AUDIO_WIDTH&#039;, 400);&lt;br /&gt;
}...&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Datei FAQ]]&lt;br /&gt;
[[es:Recurso Archivo FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Roles_FAQ&amp;diff=145553</id>
		<title>Roles FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Roles_FAQ&amp;diff=145553"/>
		<updated>2023-02-22T16:51:24Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Why doesn&amp;#039;t &amp;quot;Switch role to..&amp;quot; within a course seem to work properly? */ Space&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Roles}}&lt;br /&gt;
==What is the definition of a...==&lt;br /&gt;
&lt;br /&gt;
;Capability&lt;br /&gt;
:A configurable aspect of program behavior. Moodle has 100s of capabilities.   Each capability has a computer friendly name like [[Capabilities/mod/forum:rate|mod/forum:rate]] and a human-friendly name like &amp;quot;Rate posts.&amp;quot;&lt;br /&gt;
;Permission&lt;br /&gt;
:Permissions are paired with each  capability.  There are four possible permission values: &#039;&#039;Allow&#039;&#039;, &#039;&#039;Prevent&#039;&#039;, &#039;&#039;Prohibit&#039;&#039; and &#039;&#039;Not set&#039;&#039;/&#039;&#039;Inherit&#039;&#039;. (It is called not-set when defining roles and inherit when overriding permissions.)&lt;br /&gt;
;Role&lt;br /&gt;
:A named set of permissions that are associated with each capability. For example. the &amp;quot;Teacher&amp;quot; and &amp;quot;Student&amp;quot; roles come with the standard Moodle install.&lt;br /&gt;
;Context&lt;br /&gt;
:A functional area of Moodle. Contexts have a hierarchy.  Examples of contexts include a course, activity module, or resource.&lt;br /&gt;
&lt;br /&gt;
==Why isn&#039;t my role change taking effect?==&lt;br /&gt;
&lt;br /&gt;
Certain capabilities e.g. [[Capabilities/moodle/user:changeownpassword|moodle/user:changeownpassword]] may only be applied in the system context, so giving such permissions by assigning a role in the course context will have no effect.&lt;br /&gt;
&lt;br /&gt;
==Why do some users I know are in my course not appear in &#039;&#039;Participants&#039;&#039;?==&lt;br /&gt;
&lt;br /&gt;
Users assigned roles in a higher context, for example users assigned the role of teacher in the course category are technically not enrolled in the course and so will not appear in the Participants link in the [[Navigation block]] but can be found via &#039;&#039;Course administration &amp;gt; Users &amp;gt; Other users&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==How can I prevent a user from changing their own password?==&lt;br /&gt;
&lt;br /&gt;
==== Using roles ====&lt;br /&gt;
&lt;br /&gt;
To prevent a user from changing their own password, you must make sure they do not have [[Capabilities/moodle/user:changeownpassword|moodle/user:changeownpassword]] = Allow in the System context. The Authenticated user role (which is assigned to users in the System context) has moodle/user:changeownpassword = Allow by default, so you have two choices: &lt;br /&gt;
# Edit Authenticated user, setting moodle/user:changeownpassword = Not set &lt;br /&gt;
# Create a new role CannotChangeOwnPassword with moodle/user:changeownpassword = Prevent and all other permissions Not set. Choose &amp;quot;system&amp;quot; for the context type  and assign the role to selected users in the System context  via &#039;&#039;Administration&amp;gt;Site administration -&amp;gt; Users -&amp;gt; Permissions -&amp;gt; Assign system roles).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Choice (1) will prevent &#039;&#039;all&#039;&#039; users from changing their passwords (except for the administrator, who can do anything).  To selectively allow selected users (say teachers) to change their passwords, you could create a new role CanChangeOwnPassword with moodle/user:changeownpassword = Allow and all other permissions not set and assign the role to selected users in the System context (Site administration -&amp;gt; Users -&amp;gt; Permissions -&amp;gt; Assign system roles).&lt;br /&gt;
&lt;br /&gt;
Choice (2) allows you to be selective, but if you have a lot of users that you want to prevent (say, all students), you will have to make a lot of role assignments in the System context.  There is currently no convenient way to do this, so you might consider choice (1).&lt;br /&gt;
&lt;br /&gt;
Note that you MUST deal with this permission in the System context.&lt;br /&gt;
&lt;br /&gt;
==== Alternative solution ====&lt;br /&gt;
&lt;br /&gt;
Go to Site administration &amp;gt; Plugins &amp;gt; Manage authentication plugins. Find the &#039;forgottenpasswordurl&#039; setting and point it to a static HTML page on your server (or even a Moodle Page resource on the front page). Explain your password policy on that page. This stops users changing passwords. This applies to ALL users, however, so admins will need to fix any lost passwords for the whole site.&lt;br /&gt;
&lt;br /&gt;
==How can I prevent a user from editing their own profile?==&lt;br /&gt;
&lt;br /&gt;
See [[Roles_FAQ#How can I prevent a user from changing their own password? | How can I prevent a user from changing their own password?]]  The answer to this question is the same if you substitute &#039;&#039;edit their own profile&#039;&#039; for &#039;&#039;change their own password&#039;&#039; and &#039;&#039;[[Capabilities/moodle/user:editownprofile|moodle/user:editownprofile]]&#039;&#039; for &#039;&#039;moodle/user:changeownpassword.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== How can I allow a &amp;quot;test&amp;quot; Student user to see courses that are hidden?==&lt;br /&gt;
&lt;br /&gt;
Having a test user to try out courses before you open them to regular students is useful. But if the course is hidden, then the enroled test student will not be able to see it. The solution to this problem, if you do not wish to make the hidden course visible yet, is to create a &#039;&#039;Student tester rol&#039;&#039;, a clone of the default Student role and then set the ability to see hidden courses to Allow.&lt;br /&gt;
&lt;br /&gt;
* Create a new role in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles &amp;gt; Add a new role&#039;&#039;, then for &#039;&#039;Use role or archtype&#039;&#039; choose &#039;&#039;ARCHETYPE: Student&#039;&#039; (or Student if you have customized the default Student role already)&lt;br /&gt;
* Give the role a new shortname and fullname as appropriate, e.g. studenttester, Student Tester&lt;br /&gt;
* Change the &#039;View hidden courses&#039; [[Capabilities/moodle/course:viewhiddencourses|course:viewhiddencourses]] capability from Not Set to Allow&lt;br /&gt;
* Click the &#039;Create this role button&#039;&lt;br /&gt;
&lt;br /&gt;
Now enrol your test student in the course using this new role instead of the Student role, and they will be able to see and work in the course as a normal student even when the course is hidden. They will not be able to see other hidden courses in which they are not enroled.&lt;br /&gt;
&lt;br /&gt;
==How do I change the name for &amp;quot;teacher&amp;quot; in the course description?==&lt;br /&gt;
&lt;br /&gt;
Either&lt;br /&gt;
* Edit the role of Teacher via &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and rename it. The new name will apply site-wide.&lt;br /&gt;
Or&lt;br /&gt;
* Create a duplicate teacher role with an alternative name and assign users the duplicate teacher role as appropriate in the course context. In &#039;&#039;Site administration &amp;gt; Appearance &amp;gt; Course contact&#039;&#039; select the alternative name for teacher that you wish to be displayed in the course description when courses are listed. For example, copy the standard teacher role and call it Instructor and only show that role as the course contact.&lt;br /&gt;
Or&lt;br /&gt;
* Create a new &amp;quot;dummy&amp;quot; role (no capabilities) with those names and assign them to teachers along with the real roles. select the alternative name for teacher that you wish to be displayed in the course description when courses are listed.  For example, copy the guest role, call it Lead Teacher and make this the course contact.  You may have 5 teachers in the course but only one name will appear as Lead Teacher.   If nobody is assigned the role Lead Teacher, no course contact will show.&lt;br /&gt;
Or&lt;br /&gt;
*Names for different roles in a course may be changed in the [[Course settings|Course administration &amp;gt; edit settings]] &amp;quot;Role renaming&amp;quot; fields.  For example, some courses the teacher wants the title &amp;quot;Professor&amp;quot;, or &amp;quot;Chief&amp;quot; or &amp;quot;Mentor&amp;quot;.  &lt;br /&gt;
Or&lt;br /&gt;
*[[Language customization|Edit the language files]] and change any word you want.&lt;br /&gt;
&lt;br /&gt;
==How do I enable teachers to set role overrides?==&lt;br /&gt;
&lt;br /&gt;
#Access &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;.&lt;br /&gt;
#Edit the teacher role and change the capability [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] to allow.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
#Click the tab &amp;quot;Allow role overrides&amp;quot; (in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;).&lt;br /&gt;
#Check the appropriate box(s) in the teacher row to set which role(s) teachers can override. Most likely it will just be the student role (you don&#039;t want teachers to be able to override admins!), so check the box where the teacher row intersects with the student column.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==How do I enable teachers to assign other teachers in a course?==&lt;br /&gt;
&lt;br /&gt;
This is disabled by default but it can be switched on by modifying the teacher&#039;s role. In &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; select the &amp;quot;Allow role assignments&amp;quot; tab and tick the checkbox where Teacher and Teacher intersect.&lt;br /&gt;
&lt;br /&gt;
==Why doesn&#039;t &amp;quot;Switch role to..&amp;quot; within a course seem to work properly?==&lt;br /&gt;
&lt;br /&gt;
This feature is intended for teachers so that they can see how their course appears for students. It isn&#039;t a reliable view however, as some features do not display correctly when viewed by a teacher who has switched their role to a student. Certain actions (specifically submitting assignments) are excluded from working with &#039;switch roles&#039; (as the submitted work would not be visible on the grading pages, due to the user not having the &#039;submit&#039; permission when they have not switched roles). For that reason  it is always preferable where possible to have a &amp;quot;test&amp;quot; student log in to use.&lt;br /&gt;
&lt;br /&gt;
==How can I allow a non-editing teacher to &amp;quot;switch role to &amp;quot; a student?==&lt;br /&gt;
&lt;br /&gt;
# In &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;, edit the non-editing teacher role and set the capability &amp;quot;moodle/role:switchroles&amp;quot; to &amp;quot;allow&amp;quot;. This will then allow them to switch their role to a student or a guest (as defined on the &#039;&#039;Allow role switches&#039;&#039; screen.)&lt;br /&gt;
&lt;br /&gt;
==I accidentally deleted a default role. How do I get it back?==&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and click the &#039;Add a new role&#039; button&lt;br /&gt;
# Select the role e.g. Teacher to use&lt;br /&gt;
# Click continue&lt;br /&gt;
# Fill in the short name and custom full name&lt;br /&gt;
# Click the &#039;Create this role&#039; button&lt;br /&gt;
&lt;br /&gt;
==Are there any example roles?==&lt;br /&gt;
&lt;br /&gt;
Yes. See [[Creating_custom_roles#Example_custom_roles| the current list]].&lt;br /&gt;
&lt;br /&gt;
==How do I enable logged-in users to participate in front page activities?==&lt;br /&gt;
&lt;br /&gt;
Either:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and edit the &#039;Authenticated user on frontpage&#039; role&lt;br /&gt;
# Allow capabilities for the front page activities&lt;br /&gt;
# Click the &#039;Save changes&#039; button&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Front Page &amp;gt; Front Page settings&#039;&#039;&lt;br /&gt;
# Set the default front page role to student&lt;br /&gt;
# Click the &#039;Save changes&#039; button&lt;br /&gt;
&lt;br /&gt;
==How can I prevent students from editing their profile?==&lt;br /&gt;
&lt;br /&gt;
If you only want students to be prevented from editing their profile, and not all users, you can create a new role, such as Restricted user as described in the [[Demo teacher role]], with moodle/user:editownprofile set to prevent, and assign it to all students in the system context.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you could change moodle/user:editownprofile to not set for the [[Authenticated user role]], then create a new role for teachers with moodle/user:editownprofile set to allow.&lt;br /&gt;
&lt;br /&gt;
==Why can&#039;t I add teachers or students site wide in Moodle?==&lt;br /&gt;
&lt;br /&gt;
You can, however teachers and students typically work in one or more individual courses. It is unusual for a student to be studying every single course on your Moodle and unusual for a teacher to be teaching every single course. Therefore, the default Moodle does not use these as system wide roles.  The Manager role might be one that makes sense to assign on a system or category context.&lt;br /&gt;
&lt;br /&gt;
To assign a teacher or student site-wide&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and edit the role to include the &#039;&#039;system&#039;&#039; context. &lt;br /&gt;
#Then search for and allow the capability [[Capabilities/moodle/course:view|moodle/course:view]]&lt;br /&gt;
#Then assign users to this role via &#039;&#039;Administration&amp;gt;Site administration&amp;gt;Users&amp;gt;Permissions&amp;gt;Assign system roles&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It might be preferable to create a new role based on the teacher or student and assign this in the System context.  Then assign individuals to that role.&lt;br /&gt;
&lt;br /&gt;
==Why isn&#039;t my custom role listed as an available role for assigning?==&lt;br /&gt;
&lt;br /&gt;
When adding/editing a custom role, be sure to tick one or more context types where the role may be assigned.&lt;br /&gt;
&lt;br /&gt;
[[File:context types where role may be assigned.png]]&lt;br /&gt;
&lt;br /&gt;
==How can I set a role back to default?==&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and click on the name of the role&lt;br /&gt;
# Click the Reset button&lt;br /&gt;
# Select items for reset as desired&lt;br /&gt;
# Click the continue button.&lt;br /&gt;
&lt;br /&gt;
==Permissions don&#039;t seem to be working correctly. What can I do?==&lt;br /&gt;
&lt;br /&gt;
[[File:reviewing badge permissions.png|thumb|Reviewing role permissions]]It is recommended that permissions for each role are reviewed and set according to the role archetype.&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and click the edit icon opposite a role&lt;br /&gt;
# Click the &#039;Show advanced&#039; button to reveal the different permission settings&lt;br /&gt;
# Review permissions (filtering for particular permissions as appropriate) and, unless there is a good reason to do otherwise, change permissions so that all are set to the highlighted value&lt;br /&gt;
# Click the &#039;Save changes&#039; button&lt;br /&gt;
# Repeat steps 1 to 4 for each role&lt;br /&gt;
&lt;br /&gt;
==Is there a role that can be safely used for a government inspector/supervisor ?==&lt;br /&gt;
The  [https://github.com/3-bits/moodle-role_sepe SEPE] role is used for a (Spanish) government supervisor who can access all Moodle courses without being able to change anything. It can be used in any other country/ language.&lt;br /&gt;
&lt;br /&gt;
==What is the &amp;quot;none&amp;quot; role?==&lt;br /&gt;
It is possible to enrol users into a course so they appear as participants, but since they do not have a standard role such as student, they do not have any particular permissions. They cannot for example, engage in course activities. For discussion about the &amp;quot;none&amp;quot; role, see MDL-29599&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please visit the [http://moodle.org/mod/forum/view.php?id=6826 Roles and Capabilities forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Rollen FAQ]]&lt;br /&gt;
[[es:FAQ_roles]]&lt;br /&gt;
[[fr:FAQ des rôles]]&lt;br /&gt;
[[ja:ロールFAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Competencies_FAQ&amp;diff=145507</id>
		<title>Competencies FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Competencies_FAQ&amp;diff=145507"/>
		<updated>2023-02-07T10:53:36Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* How can students create their own learning plans? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Competencies}}&lt;br /&gt;
&lt;br /&gt;
==Can a competency be added to more than one course or activity?==&lt;br /&gt;
Definitely - and your organisation might well need to do this, if certain competencies need to be met in a series of courses or several activities within one course.&lt;br /&gt;
==I can&#039;t see evidence uploaded by my students==&lt;br /&gt;
*Are you a course teacher? You will not be able to see evidence of prior learning unless your administrator has given you a role with the capability moodle/competency:userevidenceview  set to &#039;&#039;Allow&#039;&#039;  .&lt;br /&gt;
==How does &#039;Attach evidence&#039; work?==&lt;br /&gt;
*A teacher can set &amp;quot;Attach evidence&amp;quot; as an option when an activity or a course is completed. Once an activity or course has been completed, the activity or course in question will display as Evidence at the bottom of the competency in question in a student&#039;s learning plan. A manager or other user with the capability moodle/competency:userevidenceview  set to &#039;&#039;Allow&#039;&#039;  will be able to see this evidence.&lt;br /&gt;
&lt;br /&gt;
[[File:evidencedisplayed.png|center]]&lt;br /&gt;
&lt;br /&gt;
*However, they will not be alerted that the evidence is available, so the student should request a review, as below.&lt;br /&gt;
==How does &amp;quot;Request review&amp;quot; work?==&lt;br /&gt;
* A student can request a review of a competency, for example if they have submitted a piece of work as attached evidence and they wish to alert their course tutor to this. The student accesses the competencies from their learning plan and clicks&#039;&amp;quot;Request review&amp;quot; from the Edit menu.&lt;br /&gt;
[[File:studentrequestreview.png|center]]&lt;br /&gt;
*The student will then see &#039;waiting for review&#039; next to that competency.&lt;br /&gt;
*The course tutor/supervisor or anyone who is [[Capabilities/moodle/competency:usercompetencyreview| allowed to review competencies]] will see the request from the learning plans block on their dashboard:&lt;br /&gt;
[[File:sendforreview1.png|center]]&lt;br /&gt;
*They click the link to access the student&#039;s requested competency and (&#039;&#039;1 in screenshot below&#039;&#039;) click to start the review.&lt;br /&gt;
*When the review is in progress, the words the student sees change from &#039;waiting for review&#039; to &#039;in review&#039;.&lt;br /&gt;
*The course tutor can then review the evidence (&#039;&#039;2 in screenshot below&#039;&#039;) and then (&#039;&#039;3&#039;&#039;) click to finish the review. The message &#039;in review&#039; no longer displays for the student.&lt;br /&gt;
*The course tutor can then rate the competency if required &#039;&#039;(4):&#039;&#039;&lt;br /&gt;
[[File:sendforreview2.png|center|thumb|600px]]&lt;br /&gt;
&lt;br /&gt;
==How can a course teacher review competencies?==&lt;br /&gt;
See the [[Competency reviewer]] role.&lt;br /&gt;
&lt;br /&gt;
==How can a course teacher view their students&#039; learning plans?==&lt;br /&gt;
See the [[Learning plan viewer]] role.&lt;br /&gt;
==How can a course teacher manage  their students&#039; learning plans?==&lt;br /&gt;
See the [[Learning plan supervisor]] role.&lt;br /&gt;
&lt;br /&gt;
==How do teachers rate competencies?==&lt;br /&gt;
Competencies may be met automatically upon activity completion (with the &#039;Default&#039; scale as above) or teachers may rate competencies manually with a customised &#039;Proficient&#039; scale.&lt;br /&gt;
*A teacher accesses the [[Competency breakdown report]], selects a student and clicks on a particular competency which has not yet been rated:&lt;br /&gt;
[[File:ratecompetencies12.png|center]]&lt;br /&gt;
*The teacher then clicks the &#039;Rate&#039; button:&lt;br /&gt;
[[File:ratecompetencies2.png|center]]&lt;br /&gt;
*The teacher then chooses from the desired rating from the available options:&lt;br /&gt;
[[File:ratecompetencies3.png|center]]&lt;br /&gt;
*Once saved, the Proficient scale will change if the competency was met:&lt;br /&gt;
[[File:ratecompetencies4.png]]&lt;br /&gt;
*The competency breakdown report will reflect this, using the wording of the scale:&lt;br /&gt;
[[File:ratecompetencies5.png|center]]&lt;br /&gt;
*In the example below, the first competency was manually rated &amp;quot;Highly competent&amp;quot;; the second competency was automatically met upon activity completion and the third competency was manually rated &amp;quot;Not competent&amp;quot;.&lt;br /&gt;
[[File:ratecompetencies6.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==I can&#039;t see the Learning plans block==&lt;br /&gt;
*Are you a course teacher? You will not be able to see the [[Learning plans block]] unless your administrator has  set the capability block/lp:view to Allow for teachers. However, administrators additionally need to set other capabilities in the system context relating to viewing learning plans and evidence for the block to display any useful information.&lt;br /&gt;
*It might be helpful to create a custom role, such as &#039;Supervisor&#039;, with the capabilities you wish to allow in the system context.&lt;br /&gt;
*If students have no learning plans, or if teachers/supervisors have no competencies needing reviewing, then the Learning plans block is not visible when editing is not turned on.&lt;br /&gt;
&lt;br /&gt;
== I can&#039;t see competencies when trying to add them to a learning template==&lt;br /&gt;
Make sure you are in the right part of the site. If you added competencies to a category you will need to add the learning template to that category. If you added competencies to the system you will need to add your learning plan template to the system.&lt;br /&gt;
&lt;br /&gt;
==The learning plan shows all competencies met but the course competencies screen shows some are still incomplete.==&lt;br /&gt;
*Competencies exist outside a course,so it might be that the competency has been met in another course but not the one you are in&lt;br /&gt;
*If a manager or other user who is [[Capabilities/moodle/competency:usercompetencyreview| allowed to review competencies]] chooses to &#039;&#039;rate&#039;&#039; a competency from the learning plan, then the competency will not show as complete inside the course, but it will display as complete in the learning plan.&lt;br /&gt;
&lt;br /&gt;
==The progress bar shows 100% complete but the learning plan is not marked complete.==&lt;br /&gt;
*A learning plan does not automatically display as &amp;quot;complete&amp;quot; once all competencies have been met.&lt;br /&gt;
*It may be manually marked as complete by a user with the relevant capabilities - or -&lt;br /&gt;
* a due date may be set for completion when a learning plan template is created.&lt;br /&gt;
==What is the difference between &#039;default&#039; and &#039;proficient&#039; when setting up scales in a competency framework?==&lt;br /&gt;
*The default value is what is displayed in the breakdown report and for a student in their learning plan when a competency is automatically met upon activity completion. In the example below, &#039;competent&amp;quot; will display when a student completes a task satisfactorily.&lt;br /&gt;
*Items in the Proficient list can be displayed when a teacher  rates a competency manually. There may be several different levels which can all be competent. In the example below, &#039;Just competent&#039;,&#039;Competent&#039; or &#039;Highly competent&#039; will result in the student achieving that competency:&lt;br /&gt;
[[File:levels.png|center|Custom competency scale]]&lt;br /&gt;
&lt;br /&gt;
Note that the above is a custom created scale.&lt;br /&gt;
&lt;br /&gt;
==How can students create their own learning plans?==&lt;br /&gt;
*If authenticated users have the capability &#039;&#039;[[Capabilities/moodle/competency:planviewowndraft|competency:planviewowndraft]]&#039;&#039; and &#039;&#039;[[Capabilities/moodle/competency:planmanageowndraft|competency:planmanageowndraft]]&#039;&#039;  set to &amp;quot;Allow&amp;quot; then they will see a button &amp;quot;Add new learning plan&amp;quot; when they access their learning plans from their profile.&lt;br /&gt;
*They can then create a draft learning plan and request a review of it by a manager or other user with the capability &#039;&#039;[[Capabilities/moodle/competency:planmanagedraft|moodle/competency:planmanagedraft]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==How can I export or import competency frameworks?==&lt;br /&gt;
&lt;br /&gt;
See [[Competency frameworks]].&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [https://moodle.org/mod/forum/view.php?id=8266 Competencies forum] on moodle.org&lt;br /&gt;
&lt;br /&gt;
[[de:Kompetenzen FAQ]]&lt;br /&gt;
[[es:Competencias FAQ]]&lt;br /&gt;
[[fr:FAQ des compétences]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Override_permissions&amp;diff=145492</id>
		<title>Override permissions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Override_permissions&amp;diff=145492"/>
		<updated>2023-01-29T08:47:53Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Spaces&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Roles}}&lt;br /&gt;
Overrides are specific permissions designed to override a role in a specific context, allowing you to &amp;quot;tweak&amp;quot; your permissions as required.&lt;br /&gt;
&lt;br /&gt;
Overrides may be used to &amp;quot;open up&amp;quot; areas by giving users extra permissions. For example, an override may be used to enable students to rate forum posts (see [[Forum settings]] for details).&lt;br /&gt;
&lt;br /&gt;
Overrides may also be used to prevent actions, such as starting new discussions in an archived forum.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
[[File:override permissions.png|thumb|Override permissions with overridden permission highlighted]]&lt;br /&gt;
There are four settings for each permission capability:&lt;br /&gt;
&lt;br /&gt;
;Inherit&lt;br /&gt;
:The default setting. If a capability is set to inherit, the user&#039;s permissions remain the same as they are in a less specific context, or another role where the capability is defined. For example, if a student is allowed to attempt quiz questions at the course level, their role in a specific quiz will inherit this setting. Ultimately, if permission is never allowed at any level, then the user will have no permission for that capability. &lt;br /&gt;
&lt;br /&gt;
;Allow&lt;br /&gt;
:This enables a user to use a capability in a given context. This permission applies for the context that the role gets assigned plus all lower contexts. For example, if a user is assigned the role of student in a course, they will be able to start new discussions in all forums in that course (unless a forum contains an override with a prevent or prohibit value for the capability).&lt;br /&gt;
&lt;br /&gt;
;Prevent&lt;br /&gt;
:By choosing this you are removing permission for this capability (only for this role), even if the users with this role were allowed that permission in a higher context. If any other role allows the same capability, even for a higher or lower context, this prevent will have no effect.&lt;br /&gt;
&lt;br /&gt;
;Prohibit&lt;br /&gt;
:This is rarely needed, but occasionally you might want to completely deny permissions to a role in a way that can NOT be overridden at any lower context or by another role. An example of when you might need this is when an admin wants to prohibit one person from starting new discussions in any forum on the whole system. In this case they can create a role with that capability set to &amp;quot;Prohibit&amp;quot; and then assign it to that user in the system context.&lt;br /&gt;
&lt;br /&gt;
==Conflict resolution of permissions==&lt;br /&gt;
&lt;br /&gt;
Permissions at a &amp;quot;lower&amp;quot; context will generally override anything at a &amp;quot;higher&amp;quot; context (this applies to overrides and assigned roles). The exception is PROHIBIT which can not be overridden at lower levels.&lt;br /&gt;
&lt;br /&gt;
If two roles are assigned to a person in the same context, and for a particular permission one role has ALLOW and one has PREVENT, then ALLOW will win.&lt;br /&gt;
&lt;br /&gt;
===Special exceptions===&lt;br /&gt;
&lt;br /&gt;
Note that the guest user account will generally be prevented from posting content (e.g. forums, calendar entries, blogs) even if it is given the capability to do so.&lt;br /&gt;
&lt;br /&gt;
==Locations for overriding permissions==&lt;br /&gt;
&lt;br /&gt;
*Front page context: &#039;&#039;Administration &amp;gt; Front Page settings &amp;gt; Users &amp;gt; Permissions&#039;&#039;&lt;br /&gt;
*Course category context (when used): &#039;&#039;Category &amp;gt; Administration &amp;gt; Permissions&#039;&#039; &lt;br /&gt;
*Course context: &#039;&#039;Administration &amp;gt; Course administration &amp;gt; Users &amp;gt; Permissions&#039;&#039; &lt;br /&gt;
*Module context: (from the chosen module) &#039;&#039;Administration &amp;gt; Module administration &amp;gt; Permissions&#039;&#039;&lt;br /&gt;
*Block context: (from the chosen block) &#039;&#039;Administration &amp;gt; Block administration &amp;gt; Permissions&#039;&#039;&lt;br /&gt;
*User context: (from the user&#039;s profile) &#039;&#039;Administration &amp;gt; Roles &amp;gt; Permissions&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Ability to override permissions==&lt;br /&gt;
&lt;br /&gt;
Users who have the capability [[Capabilities/moodle/role:override|moodle/role:override]] allowed or the capability [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] allowed) can override permissions for selected roles (as set in [[Allow role overrides]]).&lt;br /&gt;
&lt;br /&gt;
The default manager role has the capability moodle/role:override allowed, and can override permissions for all other roles.&lt;br /&gt;
&lt;br /&gt;
The default teacher role has the capability moodle/role:safeoverride allowed, and can override permissions for the roles of non-editing teacher, student and guest.&lt;br /&gt;
&lt;br /&gt;
==Enabling non-editing teachers to override safe permissions==&lt;br /&gt;
&lt;br /&gt;
#Access &#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;.&lt;br /&gt;
#Edit the non-editing teacher role and change the capability [[Capabilities/moodle/role:safeoverride]] to allow.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
#Click the tab &amp;quot;Allow role overrides&amp;quot; (in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;).&lt;br /&gt;
#Check the appropriate box(s) in the non-editing teacher row to set which role(s) they can override. Most likely it will just be the student role (you don&#039;t want non-editing teachers to be able to override managers), so check the box where the non-editing teacher row intersects with the student column.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If preferred, a new role for overriding permissions may be created and selected non-editing teachers assigned to it.&lt;br /&gt;
&lt;br /&gt;
==Overriding permissions for selected students==&lt;br /&gt;
Sometimes a teacher will want to override permissions for selected students. Typically they will assign a student a role locally. For example, assign a student as a non-editing teacher.  However, managers can override specific permission in a role.  This does not create a new role. It modifies an existing specific role and affects all users assigned to that role in the context. &lt;br /&gt;
&lt;br /&gt;
Sometimes the administrator (or someone with the permissions to) will create a new role.  For example, the administrator will copy all the student permissions to a new role, then change specific permissions. The teacher then assigns specific students to this role without having to worry about checking off the correct role permissions.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=199435 Course role which revokes capability granted in a sitewide role] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:Anular permisos]]&lt;br /&gt;
[[eu:Baimenak kendu]]&lt;br /&gt;
[[fr:Définir des dérogations aux rôles]]&lt;br /&gt;
[[ja:ロールのオーバーライド]]&lt;br /&gt;
[[de:Zugriffsrechte ändern]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=PHP&amp;diff=145311</id>
		<title>PHP</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=PHP&amp;diff=145311"/>
		<updated>2022-12-18T14:42:58Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* PHP Extensions and libraries */ GD has been required since Moodle 2.5 (MDL-34331)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
PHP is the scripting language in which Moodle is developed. It is integrated with your web server. The web server detects php pages (by their extension) and sends them to PHP for execution. PHP must be installed and configured properly for Moodle to work effectively (or at all).&lt;br /&gt;
==PHP Versions==&lt;br /&gt;
* Moodle 3.0.1 and later support PHP 7, however&lt;br /&gt;
** Moodle 3.1 and earlier does not support PHP 7.1 or later (this means that there is currently no combination of releases of Moodle and PHP that are still supported before Moodle 3.4);&lt;br /&gt;
* Moodle 3.4 and Moodle 3.5 &#039;&#039;&#039;require&#039;&#039;&#039; PHP 7.0 or PHP 7.1 or PHP 7.2&lt;br /&gt;
* Moodle 3.6 &#039;&#039;&#039;requires&#039;&#039;&#039; PHP 7.0 or later&lt;br /&gt;
* Moodle 3.7 &#039;&#039;&#039;require&#039;&#039;&#039; PHP 7.1 or later&lt;br /&gt;
* Moodle 3.9 &#039;&#039;&#039;require&#039;&#039;&#039; PHP 7.2 or later&lt;br /&gt;
* Moodle 3.11 and later &#039;&#039;&#039;require&#039;&#039;&#039; PHP 7.3 or later&lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. If you change php.ini, don&#039;t forget to restart the server. &lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; needs to be at least 96M (although some functions may not work if this low). Moodle will refuse to install if lower. 128M is recommended. Large systems may need an even higher setting.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF. (DEPRECATED in PHP 5.3.0, and REMOVED as of PHP 7.0.0.)&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* The temp folder must be defined and writeable by your webserver user&lt;br /&gt;
* Check the error display/logging section. Make sure the settings are appropriate for your server use.&lt;br /&gt;
* &#039;&#039;post_max_size&#039;&#039; and &#039;&#039;upload_max_filesize&#039;&#039; restrict the maximum file size that can be uploaded.&lt;br /&gt;
* Check the &#039;&#039;[mail function]&#039;&#039; and database section (for your chosen database) to make sure they match your server configuration.&lt;br /&gt;
==HTTP_RAW_POST_DATA errors==&lt;br /&gt;
Some users are experiencing $HTTP_RAW_POST_DATA related errors, when establishing connection between MNET servers or making AJAX web services requests.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Request for server name returned empty response&lt;br /&gt;
 &lt;br /&gt;
    line 134 of /mnet/lib.php: call to debugging()&lt;br /&gt;
    line 115 of /admin/mnet/peers.php: call to mnet_get_public_key()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
These errors are affecting installations running moodle on PHP 5.6 version and it&#039;s a PHP bug on the &#039;&#039;&#039;always_populate_raw_post_data&#039;&#039;&#039; setting the default value to 0.&lt;br /&gt;
&lt;br /&gt;
To avoid the error messages above, please change the value following setting on your php.ini file:&lt;br /&gt;
* &#039;&#039;&#039;always_populate_raw_post_data&#039;&#039;&#039; should be changed to &#039;&#039;&#039;-1&#039;&#039;&#039;.&lt;br /&gt;
For more information about this bug, see: https://bugs.php.net/bug.php?id=66763&lt;br /&gt;
==Finding the correct php.ini==&lt;br /&gt;
Sometimes it is not obvious where the php.ini file is located or you may even find more than one. To be certain run &#039;phpinfo&#039; - see below. The path of the php.ini file is a few lines down in the top section. &lt;br /&gt;
&lt;br /&gt;
Note that if you are using command-line (CLI) PHP for running cron (or anything else) it may be configured with a &#039;&#039;different&#039;&#039; php.ini file. To check, run the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
php -i | grep php.ini&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
The following PHP extensions are required or recommended (some, e.g. iconv, ctype and tokenizer are now included in PHP by default). Others will need to be installed or selected.&lt;br /&gt;
* The &#039;&#039;&#039;iconv&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;mbstring&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;curl&#039;&#039;&#039; extension is required (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;openssl&#039;&#039;&#039; extension is recommended (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;tokenizer&#039;&#039;&#039; extension is recommended.&lt;br /&gt;
* The &#039;&#039;&#039;xmlrpc&#039;&#039;&#039; extension is recommended (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;soap&#039;&#039;&#039; extension is recommended (required for web services).&lt;br /&gt;
* The &#039;&#039;&#039;ctype&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;zip&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;gd&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;simplexml&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;spl&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;pcre&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;dom&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;xml&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;intl&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;json&#039;&#039;&#039; extension is required.&lt;br /&gt;
* &#039;&#039;&#039;The appropriate extension for your chosen database is also required.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
&lt;br /&gt;
==Installing (missing) extensions==&lt;br /&gt;
This depends on how PHP was installed on your machine and what access you have. Here are some possibilities:&lt;br /&gt;
* If this is a hosted server you are likely to have to ask the administrator or hosting company. &lt;br /&gt;
* If PHP was compiled from source you will need to recompile, changing the &#039;configure&#039; settings - see [[Compiling PHP from source]].&lt;br /&gt;
* If it was installed using packages (typically Linux) you can install the required package (see your Linux distribution&#039;s documentation)&lt;br /&gt;
* If you are using Windows you just need to uncomment the appropriate DLL files in php.ini&lt;br /&gt;
After making any changes or additions, don&#039;t forget to re-start your web server.&lt;br /&gt;
== .htaccess files ==&lt;br /&gt;
If you don&#039;t have access to the php.ini file or there are conflicting requirements with other PHP applications on the same server you may be able to change PHP settings in an .htaccess file. This should be placed in the &#039;root&#039; of your Moodle installation (i.e. the same place as the config.php file). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The file isn&#039;t always called .htaccess and may not work at all. Contact your server administrator to be sure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Settings are made by adding lines in one of two formats:&lt;br /&gt;
* php_value &#039;&#039;name value&#039;&#039;&lt;br /&gt;
* php_flag &#039;&#039;name on/off&#039;&#039;&lt;br /&gt;
Examples:&lt;br /&gt;
* &#039;&#039;&#039;php_value memory_limit 128M&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;php_flag register_globals off&#039;&#039;&#039;&lt;br /&gt;
==PHP info==&lt;br /&gt;
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:&lt;br /&gt;
* that your PHP installation meets Moodle&#039;s system requirements.&lt;br /&gt;
* the values that are currently applied to your server&#039;s PHP install, e.g. File upload limits&lt;br /&gt;
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.&lt;br /&gt;
=== Displaying phpinfo in Moodle===&lt;br /&gt;
An administrator can find PHP info in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; PHP info&#039;&#039;.&lt;br /&gt;
=== Displaying phpinfo outside of Moodle ===&lt;br /&gt;
To view the phpinfo information:&lt;br /&gt;
* Create a file called info.php using your text editor, containing this single line:&lt;br /&gt;
 &amp;lt;code php&amp;gt;&lt;br /&gt;
 &amp;lt;?php phpinfo(); ?&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
* Save this file as info.php&lt;br /&gt;
* Upload this file into the root web accessible folder on your server.&lt;br /&gt;
* Now open this file in your browser. For example &amp;lt;nowiki&amp;gt;http://&amp;lt;server-name&amp;gt;/info.php&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Compiling PHP from source]]&lt;br /&gt;
* [https://docs.moodle.org/dev/Moodle_and_PHP7 Moodle and PHP7] in the developers documentation&lt;br /&gt;
*http://www.php.net/ - the PHP web site&lt;br /&gt;
*http://php.iis.net/ - Microsoft PHP Installer for IIS&lt;br /&gt;
* [[MoodleDocs:Style_guide#PHP_syntax_highlighting]] to highlight PHP syntax&lt;br /&gt;
* [[Code syntax highlighting]] that uses the GeSHi (Generic Syntax Highlighter) filter. &lt;br /&gt;
[[de:PHP]]&lt;br /&gt;
[[es:PHP]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=admin/environment/php_extension/gd&amp;diff=145310</id>
		<title>admin/environment/php extension/gd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=admin/environment/php_extension/gd&amp;diff=145310"/>
		<updated>2022-12-18T14:16:51Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Installing */ Add instructions for Windows&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
== GD extension for PHP ==&lt;br /&gt;
&lt;br /&gt;
This extension provides functionality for handling graphics directly from PHP scripts. It supports the PNG, JPEG, XPM formats as well as FreeType/ttf fonts.&lt;br /&gt;
&lt;br /&gt;
== Installing ==&lt;br /&gt;
Package names below may vary if using third party package repositories or the PHP version is different from the operating system&#039;s default.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
Download and install gd:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install php-gd&lt;br /&gt;
&lt;br /&gt;
You might need to restart Apache (not necessary):&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
=== CentOS ===&lt;br /&gt;
Download and install gd:&lt;br /&gt;
&lt;br /&gt;
 dnf install php-gd&lt;br /&gt;
&lt;br /&gt;
You might need to restart PHP-FPM to apply the change in configuration:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart php-fpm&lt;br /&gt;
&lt;br /&gt;
If you are unable to find the correct package try searching with:&lt;br /&gt;
&lt;br /&gt;
 dnf search &#039;php*-gd&#039;&lt;br /&gt;
&lt;br /&gt;
=== Microsoft Windows ===&lt;br /&gt;
The gd extension is normally included in the &#039;&#039;ext&#039;&#039; folder with PHP for Microsoft Windows. If Moodle reports this is missing ensure the following line is in &#039;&#039;php.ini&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 extension=gd&lt;br /&gt;
&lt;br /&gt;
There must be no &#039;;&#039; at the start of this line.&lt;br /&gt;
&lt;br /&gt;
You will probably need to restart your web server to apply this change: for XAMPP run &#039;&#039;xampp_stop&#039;&#039; then &#039;&#039;xampp_start&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment|PHP]]&lt;br /&gt;
&lt;br /&gt;
[[es:admin/environment/php extension/gd]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Cron_with_Unix_or_Linux&amp;diff=145285</id>
		<title>Cron with Unix or Linux</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Cron_with_Unix_or_Linux&amp;diff=145285"/>
		<updated>2022-12-14T20:10:16Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Using the crontab program on Unix/Linux */ Capitalisation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
On Unix and Linux use the built in &#039;&#039;cron&#039;&#039; program which is standard on nearly all systems. You are required to add a command to the &#039;crontab&#039; (the table that holds cron commands) for the web server user. &lt;br /&gt;
&lt;br /&gt;
There are two different methods that can be used to invoke the Moodle cron process:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; The commands shown need to be added to the crontab to function (described in a moment). However, you can - and should - run them on the command line to check they work first. &lt;br /&gt;
&lt;br /&gt;
== Method 1: The command line (cli) cron ==&lt;br /&gt;
&lt;br /&gt;
If you have a choice, this is normally the best way to run Moodle cron. &lt;br /&gt;
&lt;br /&gt;
PHP is also capable of running programs directly from the command line. Your system needs to be set up to do this; specifically you need the &#039;CLI&#039; version of PHP to be installed. Most systems with PHP installed will have this by default. If you have the PHP CLI version installed then this is the recommended method of invoking cron. The correct command will be something like...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/php /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(substitute the correct path to moodle and for php as required)&lt;br /&gt;
&lt;br /&gt;
You can simply type this on the command line this to see if it works. If you are not sure about the path to PHP you can type &amp;quot;&amp;lt;code&amp;gt;which php&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tip:&#039;&#039;&#039;: If you have problems, see the [[PHP]] page. In particular, suspect an alternate php.ini for the CLI PHP command which may not have suitable settings.&lt;br /&gt;
&lt;br /&gt;
== Method 2: Web based cron ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; In order to use the web based cron script you must first check [[Cron settings]] to make sure this method is permitted. &lt;br /&gt;
&lt;br /&gt;
The idea is to call the following web page (you can try this from your browser):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://url.of.your/moodle/admin/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A command line (text based) browser is needed to run this on the server. Possibilities are as follows (OSX, for example, only ships with curl)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/wget -q -O /dev/null/ http://url.of.your/moodle/admin/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(no output is displayed - remove the &#039;&#039;-O /dev/null/&#039;&#039; to test)&lt;br /&gt;
&lt;br /&gt;
...OR...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/curl http://url.of.your/moodle/admin/cron.php -o /dev/null/ -silent&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(no output is displayed - remove the &#039;&#039;-o /dev/null/ -silent&#039;&#039; to test)&lt;br /&gt;
&lt;br /&gt;
==Using the crontab program on Unix/Linux==&lt;br /&gt;
&lt;br /&gt;
Once you have selected (and tested!) an appropriate command to invoke the Moodle cron it must be added to the web users &#039;crontab&#039; to schedule it to run regularly. &#039;Crontab&#039; is both a file containing the user&#039;s cron commands and is also the name of the (command line) program used to edit it. Use the following command (as root) substituting the correct user in place of &#039;www-data&#039; (e.g. &#039;apache&#039; for CentOS, &#039;www-data&#039; for Debian/Ubuntu, &#039;_www&#039; for macOS—Google will know!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# crontab -u www-data -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will bring up an editor window (the first time it may ask you which editor to use). Add the command onto the end of the file in this way (it may be empty or it may have some instructional comments):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The first five * entries specify the times, followed by the command, to run. This says to run the command as often as possible, i.e. every minute.&lt;br /&gt;
&lt;br /&gt;
See https://en.wikipedia.org/wiki/Cron#CRON_expression for details on cron expressions.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://linuxweblog.com/node/24 A basic crontab tutorial] &lt;br /&gt;
* [http://www.freebsd.org/cgi/man.cgi?query=crontab&amp;amp;apropos=0&amp;amp;sektion=5&amp;amp;manpath=FreeBSD+6.0-RELEASE+and+Ports&amp;amp;format=html Online version of the man page]&lt;br /&gt;
&lt;br /&gt;
[[es:Cron con Unix o Linux]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Quiz_FAQ&amp;diff=145169</id>
		<title>Quiz FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Quiz_FAQ&amp;diff=145169"/>
		<updated>2022-12-05T21:52:37Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Can I print the quiz results without the answers history? */ Spelling/grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz}}&lt;br /&gt;
==General==&lt;br /&gt;
===How can guests answer a Moodle quiz?===&lt;br /&gt;
&lt;br /&gt;
It is not possible for guests to use [[Activities|activities]] in Moodle.&lt;br /&gt;
&lt;br /&gt;
But you can  build a quiz on Google Forms and give a link from within Moodle.&lt;br /&gt;
&lt;br /&gt;
===How can I try a quiz before it is released?===&lt;br /&gt;
&lt;br /&gt;
You have prepared a quiz exam for your students. It is currently in a hidden state. The exam opens on the day of the exam, at a time that the students know about. However, to satisfy yourself that it is doable in the time allotted, You wish to do a dry run yourself before that date. How can You accomplish this?&lt;br /&gt;
&lt;br /&gt;
Method 1: Use the Preview feature available to you as a teacher as you are making the quiz.&lt;br /&gt;
 &lt;br /&gt;
Method 2: &lt;br /&gt;
&lt;br /&gt;
# Make a dummy account with a name like &amp;quot;Test Student&amp;quot;.&lt;br /&gt;
# Enrol that user in the course as a student.&lt;br /&gt;
# Add a &amp;quot;User override&amp;quot; to the quiz, so &amp;quot;Test Student&amp;quot; can attempt the quiz before it is open to everyone else.&lt;br /&gt;
# Log in as &amp;quot;Test student&amp;quot;.&lt;br /&gt;
# Attempt the quiz.&lt;br /&gt;
# Log back in as teacher.&lt;br /&gt;
# Review the attempt.&lt;br /&gt;
# Go to Results -&amp;gt; Grades and delete the test attempt.&lt;br /&gt;
# Un-enrol &amp;quot;Test Student&amp;quot; from your course.&lt;br /&gt;
&lt;br /&gt;
Method 3: Set up a Moodle Playground course for your teachers. Add teachers with dual role (teacher and student). Teachers can later copy the quiz/assignment/whatever over to their live class.&lt;br /&gt;
&lt;br /&gt;
===How can I enable notification of quiz submissions?===&lt;br /&gt;
&lt;br /&gt;
See [[Quiz submission notification]].&lt;br /&gt;
&lt;br /&gt;
===How do I send a bulk message to all students who haven&#039;t completed a quiz?===&lt;br /&gt;
*From your navigation block, click &#039;&#039;Reports&amp;gt;Course participation&#039;&#039;&lt;br /&gt;
*From the drop down, choose your quiz.&lt;br /&gt;
*In &#039;&#039;Show only&#039;&#039;, choose &amp;quot;Student&amp;quot; and in &#039;&#039;Actions&#039;&#039;, choose &amp;quot;post&amp;quot;&lt;br /&gt;
*In the list that appears, tick/check the boxes next to those you wish to message.&lt;br /&gt;
*In the bottom dropdown &#039;&#039;With selected users&#039;&#039;, choose &amp;quot;send message&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:quizemail.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===How can build a quiz that picks X questions randomly from a larger question bank?===&lt;br /&gt;
See the section on adding random questions in [[Building Quiz]].&lt;br /&gt;
&lt;br /&gt;
===How can I print a copy of a quiz?===&lt;br /&gt;
&lt;br /&gt;
Use your browser printer option (for example by right-clicking and selecting Print) When a student prints their finished quiz, responses and feedback will also be printed.&lt;br /&gt;
&lt;br /&gt;
[[File:browserquizprint29.png|thumb|center|400px|Print preview of finished quiz - Click to enlarge]]&lt;br /&gt;
&lt;br /&gt;
You can also export the question as Moodle XML, or GIFT format. If you open either of those files in a text-editor, you should be able to see most of the details of each question. &lt;br /&gt;
&lt;br /&gt;
=== How can I print all the students&#039; quiz questions and answers?===&lt;br /&gt;
*Two options are available:&lt;br /&gt;
** Install the [https://moodle.org/plugins/quiz_archive quiz archive report] additional plugin  - Moodle quiz report plugin to achieve archiving your test, by printing out all attempts at once.&lt;br /&gt;
** Install the [https://moodle.org/plugins/quiz_answersheets Export quiz attempts] additional plugin - This quiz report allows you to get view of a quiz attempt that is formatted for easy printing. &lt;br /&gt;
=== How can I optimize a Moodle server for performing more concurrent quizzes? ===&lt;br /&gt;
&lt;br /&gt;
See [[Performance recommendations]], also the forum discussion [https://moodle.org/mod/forum/discuss.php?d=418615 Quiz with 400+ concurrent users: what‘s best?]&lt;br /&gt;
&lt;br /&gt;
=== Can I release the answers to students who did not attempt a quiz? ===&lt;br /&gt;
Yes. One way to handle this with standard Moodle would be to open the quiz after the deadline and add a time limit to the quiz of one second. Unless students are extremely quick they will not be able to gain any points, but would see the general feedback.&lt;br /&gt;
&lt;br /&gt;
=== How can I make Moodle quizzes if my school does not have enough computers / fast internet / a good Moodle server? ===&lt;br /&gt;
* Check the [[Offline quiz activity]] additional plugin.&lt;br /&gt;
* Check the [https://moodle.org/plugins/mod_exam exam] additional plugin. It allows the teacher to build quizzes with multiple choice question based on Quiz module. Main purpose of Exam module is to improve performance of quiz and to reduce database overhead, so that a large number of users can attempt quiz simultaneously. Warning  - Technically it is possible for students to manipulate their exam grades if they know right parameters or they could see correct answers if they could read javascript objets being transmitted in their browser. Use with Caution.&lt;br /&gt;
* Read about the use of Chromebooks and iPad in the [[https://docs.moodle.org/38/en/Safe_Exam_Browser | Safe Exam Browser]] Moodle documentation for version until 3.8.&lt;br /&gt;
* Visit the page for [https://www.eventbrite.com.au/o/transforming-exams-e-exams-symposium-17431618115 Transforming Exams] - Transforming Exams is an Australian Government funded research project looking at approaches to conducting authentic digital assessment in the exam rooms of Australian universities via the use of Bring-your-own laptops. The project involves 10 Australian university partners and is lead out of Monash University. See [http://transformingexams.com/ TransformingExams.com] for project information.&lt;br /&gt;
&lt;br /&gt;
===Can I print the quiz results without the answers history?===&lt;br /&gt;
If you want to print the results of all the student attempts, but omit the answers history, as it might take much space, you can do so by accessing the settings on Site admin -&amp;gt; Appearance -&amp;gt; Additional HTML. In the &#039;Within head&#039; setting, put something like:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
 @media print {&lt;br /&gt;
     .que .history {&lt;br /&gt;
         display: none;&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Is it possible for a teacher to add a personal/private note to a student&#039;s quiz submission?===&lt;br /&gt;
Not really, but as a workaround, you can use the buit-in [[Notes]] feature.&lt;br /&gt;
&lt;br /&gt;
===Copying a quiz===&lt;br /&gt;
When you add questions to a quiz, you are not actually adding questions, but rather links or pointers to questions in the question bank. When you copy a quiz, two things can happen depending on where the questions are placed:&lt;br /&gt;
&lt;br /&gt;
* If the questions are placed in a question category of the quiz, for example the &amp;quot;Default category for questions shared in the quiz context&amp;quot;, the quiz is copied as well as the question category together with the questions it contains. See [[https://docs.moodle.org/402/en/Question_contexts#How_to_access_the_Quiz_activity_context How to access the Quiz activity context]].&lt;br /&gt;
* If the questions are not placed in a question category of the quiz, the quiz is copied but not the questions. However, the links to the original questions are copied. Therefore, when editing the quiz copy, you are also editing the questions of the original quiz, because the question links point to the same questions. Be careful!&lt;br /&gt;
&lt;br /&gt;
=== Can I know the marks per each section of a quiz?===&lt;br /&gt;
An additional plugin [https://moodle.org/plugins/quiz_markspersection Marks per section] does exactly that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
&lt;br /&gt;
===Why am I no longer allowed to add or remove questions?===&lt;br /&gt;
Most likely it is because you have students that have already attempted the quiz. You will need to delete all of the attempts by selecting them and choosing to delete them if you need to add/remove questions from a quiz. &lt;br /&gt;
&lt;br /&gt;
If you are developing a new quiz where the attempts have just been trials then deleting the previous attempts will have no consequences in the grade book. &lt;br /&gt;
&lt;br /&gt;
There are several ways of getting to the “attempts #” which you need to click on to delete the previous attempts. Use which ever works for you.&lt;br /&gt;
#Click on the quiz that you want to amend. It will take you to a page with “attempts #&amp;quot; at the top.&lt;br /&gt;
#If you are on a page with this message “You cannot add or remove questions because the quiz has been attempted (attempts #)” Click on &amp;quot;attempts #&amp;quot;.&lt;br /&gt;
#If you have navigated away from the page with the message go to the Settings block &amp;gt; Quiz Administration &amp;gt; Edit Quiz.&lt;br /&gt;
Whichever way you find “attempts #” click on it and you will go to a page with a drop down menu at the top. Select “all users who have attempted the quiz”. There are several other click boxes select whatever applies to your situation.&lt;br /&gt;
Click “Show Report” and then “select all”. Click “Delete selected attempts” and confirm selection.&lt;br /&gt;
&lt;br /&gt;
Go back to  Quiz Administration &amp;gt; Edit Quiz and you will now be able to add or delete questions.&lt;br /&gt;
&lt;br /&gt;
===How can I remove a problem question after the quiz has been taken?===&lt;br /&gt;
&lt;br /&gt;
You can not remove a question once a quiz has been taken by one student or more. However you can change the score and flag the question so you know it has problems.&lt;br /&gt;
&lt;br /&gt;
Set the score for that question to 0. &lt;br /&gt;
*Caution: In some versions of Moodle if you use this question in an other quiz, this will potentially change the question in that quiz as well. A trick is to score the question as 0, then regrade the just completed quiz. This will establish the new grade for gradebook.  Now go back and change the score to the original value.  &lt;br /&gt;
&lt;br /&gt;
Find the question in Question Bank.  Maybe edit the title (e.g. &#039;Do not use in Bio101&#039;).  Or if you do not share the question category with other teachers, create a sub category, move the offending question there, and perhaps create a better question to replace the one you just moved.  Create a new quiz and if necessary hide the old one.&lt;br /&gt;
*Caution: if other departments or teachers use a question category it might be wise to check with the team before moving or changing any question.   This is one reason importing questions in a course is a good best practice in some situations.&lt;br /&gt;
&lt;br /&gt;
===How can I turn off glossary auto-linking in a quiz? ===&lt;br /&gt;
*In the Quiz administration settings block there will be a link &amp;quot;filter&amp;quot;.&lt;br /&gt;
*Click the link and you will have the option to disable filters just for that particular quiz:&lt;br /&gt;
&lt;br /&gt;
===Can I make a second quiz start right away after a first quiz is finished?===&lt;br /&gt;
By using a hack (See [https://moodle.org/mod/forum/discuss.php?d=377382 this forum thread]). &lt;br /&gt;
&lt;br /&gt;
In the &#039;Overall feedback&#039; for the first quiz, add some code which redirects to the second quiz. Make a big button to make that obvious:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;div style=&amp;quot;text-align:center;padding:20px;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;quot;https://--your domain--/mod/quiz/view.php?id=--quiz 2 no--&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button type=&amp;quot;button&amp;quot; style=&amp;quot;height:100px;font-size:24px;&amp;quot;&amp;gt;Click here to access Quiz 2&amp;lt;/button&amp;gt;&lt;br /&gt;
  &amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It would look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Click here to access Quiz 2.png|200px]]&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* The button will not appear in the gradebook.&lt;br /&gt;
* In the quiz settings and under Review options, select &#039;Overall feedback&#039; under &#039;Immediately after the attempt&#039;. Deselect &#039;Overall feedback&#039; under &#039;Later, while the quiz is still open&#039; and &#039;After the quiz is closed&#039;.&lt;br /&gt;
&lt;br /&gt;
===Prevent entry to a quiz some time after its start===&lt;br /&gt;
Suppose a quiz is set to open at 13:00 and the time limit is set to 45 minutes or some other value. Students have to enter the quiz from 13:00 to 13:15, otherwise they should not be able to do so. Proceed as follows to prevent students from entering the quiz after 13:15.&lt;br /&gt;
&lt;br /&gt;
Create another quiz, let&#039;s call it an &#039;entry&#039; quiz, containing a simple multiple choice, true or false, or short answer question, such as &amp;quot;Do you want to take the quiz? Y or N&amp;quot; or any other similar question. Tell students that they must answer and &amp;quot;Submit all and finish&amp;quot; in order to access the main quiz. In the settings of this entry quiz, set &amp;quot;Open the quiz&amp;quot; to 13:00 and &amp;quot;Close the quiz&amp;quot; to 13:15, that is, it is only open for the first 15 minutes.&lt;br /&gt;
&lt;br /&gt;
In the main quiz settings and under &amp;quot;Restrict access&amp;quot;, add a &amp;quot;Grade&amp;quot; restriction and select the entry quiz. If you do not specify a grade, the restriction is satisfied regardless of the grade obtained in the entry quiz.&lt;br /&gt;
&lt;br /&gt;
You can also add &amp;quot;Date&amp;quot; restrictions to both the entry quiz and the main quiz to control their display.&lt;br /&gt;
&lt;br /&gt;
Thus, punctual students will have access to the entry quiz from 13:00 to 13:15 and therefore to the main quiz throughout its 45 minutes duration. Latecomers will not have access to the entry quiz after 13:15 and therefore they will not be able to access the main quiz at all.&lt;br /&gt;
&lt;br /&gt;
==Attempts==&lt;br /&gt;
&lt;br /&gt;
===How can I give particular students extra time or numbers of attempts?===&lt;br /&gt;
*In the Quiz administration there is a link &amp;quot;User overrides&amp;quot;&lt;br /&gt;
*Click this link and you will be able to choose one or more users and change quiz dates, times or number of attempts.&lt;br /&gt;
&lt;br /&gt;
[[File:quizuseroverride.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Can I have different start times/timings/numbers of attempts for different groups?===&lt;br /&gt;
*In the Quiz administration settings block, there is a link &amp;quot;group overrides&amp;quot; that allows you to do things like grant extensions to certain groups of students.&lt;br /&gt;
*Click this link and you will be able to select your groups and change the quiz dates, times and number of attempts:&lt;br /&gt;
&lt;br /&gt;
[[File:quizgroupoverride.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===What happens if students submit answers after the quiz closing date?===&lt;br /&gt;
It is possible for students to still submit answers after the quiz has closed (for example if they started the attempt before the closing date but then took a long time before submitting). These responses are stored by the quiz module, but the students are not given any credit for them. The teacher can see these answers when reviewing the student&#039;s attempts and can give the student credit for them by manually entering a grade in the gradebook. Also the teacher could change the closing date after the fact and regrade the attempts. The students&#039; answers would then get graded.&lt;br /&gt;
&lt;br /&gt;
===How can a &amp;quot;Never submitted quiz&amp;quot; attempt be submitted?===&lt;br /&gt;
Currently  there is no way to retrieve an attempt that was &amp;quot;Never Submitted&amp;quot;, and get it back into the &amp;quot;In progress&amp;quot; state. Perhaps the best solution is to plan ahead and set your quiz to set your quiz to be submitted automatically.  Alternatively, you can&lt;br /&gt;
# Update the quiz : set the &amp;quot;close the quiz&amp;quot; date after today&lt;br /&gt;
# Set &amp;quot;When time expires&amp;quot; to &amp;quot;There is a grace period ...&amp;quot;&lt;br /&gt;
#Under Grade set &amp;quot;Attempts allowed&amp;quot; to &amp;quot;unlimited&amp;quot;&lt;br /&gt;
#Question behavior: Each attempt builds on the last &amp;quot;Yes&amp;quot;&lt;br /&gt;
# Invite the students who did not close their exams&lt;br /&gt;
# Allow them to start a new attempt, and close it immediately.&lt;br /&gt;
&lt;br /&gt;
===Why can&#039;t people (guests) attempt a quiz without creating an account and logging in?===&lt;br /&gt;
&lt;br /&gt;
This is difficult to implement for technical reasons.&lt;br /&gt;
&lt;br /&gt;
To explain: The quiz has to link all information about an attempt to a particular &#039;user&#039; record in the database, and each user can only have one open quiz attempt at a time. All not-logged-in users share the same &#039;guest&#039; user database record. Therefore, two guests could not attempt the quiz at the same time, and even if they could, it would be difficult to prevent one guest seeing another guest&#039;s attempts.&lt;br /&gt;
&lt;br /&gt;
Of course, given enough work, it would be possible to change some of those assumptions, and so make it possible for guests to attempt quizzes. Indeed, some of the obstructions to implementing this have already been removed while doing other work on the quiz, but there is still some way to go. If you would like to see this implemented, please vote for MDL-17892.&lt;br /&gt;
&lt;br /&gt;
A workaround is to create a visitor account, say with username = guest,  password = visitor, for everyone to share.&lt;br /&gt;
&lt;br /&gt;
===How can I prevent a student from reviewing or jumping around questions in a quiz?===&lt;br /&gt;
You can block the quiz navigation block and the summary of quiz page with CSS code in a theme.   However, if a student fails to answer a question, they will not know if you implement this &amp;quot;solution&amp;quot;. Also if others on the site do not want this patch, make sure the theme you select for the course is not used by others.&lt;br /&gt;
&lt;br /&gt;
For example using the Afterburner theme, enter this in the CSS code area:&lt;br /&gt;
&lt;br /&gt;
:div#mod_quiz_navblock {visibility:hidden;}&lt;br /&gt;
:table.quizsummaryofattempt {visibility:hidden;}&lt;br /&gt;
&lt;br /&gt;
There are other CSS solutions.&lt;br /&gt;
&lt;br /&gt;
===How can I force my students to answer all the question in a quiz before they submit?===&lt;br /&gt;
&lt;br /&gt;
There are various ways to answer this:&lt;br /&gt;
# You can&#039;t.&lt;br /&gt;
# Your students are not stupid. They know they will get zero marks for any question they do not answer, so they already have a strong incentive to answer every question. Furthermore, at the end of the quiz there is the summary page where they can easily check that they have answered all the questions before they submit, so they won&#039;t accidentally miss questions.&lt;br /&gt;
# OK, so you want us to write code that won&#039;t let students submit before they have answered each question. Well, all that does is forces the student to put random junk like &amp;quot;asdf&amp;quot; into each question before they click the button, or randomly make a choice in each multiple choice question. There is no educational benefit in this. You get more meaningful information if students leave those questions blank rather than putting in random responses.&lt;br /&gt;
&lt;br /&gt;
=== Can I force a user to reattempt only incorrect questions in subsequent attempts?===&lt;br /&gt;
&lt;br /&gt;
The easiest way to implement this solution is to use javascript or modify the source code on your Moodle site. The javascript solution described in [https://moodle.org/mod/forum/discuss.php?d=395125 this forum thread] is as follows:&lt;br /&gt;
&lt;br /&gt;
* Insert the following code in the HTML of the text of a description question.&lt;br /&gt;
* Include this description question in the quizzes. If the quizzes are displayed on multiple pages, add the description question on each page.&lt;br /&gt;
* If you are using the [[Adaptable theme]] you can put the JS in the JS section of the [[Adaptable theme]]. With the standard [[Boost theme]] or [[Classic theme]] place the script in the Site Administration / Appearance / Additional HTML section. This way you don&#039;t have to include the script in every quiz.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;h3&amp;gt;Title of the quiz&amp;lt;/h3&amp;gt;  // optional&lt;br /&gt;
&amp;lt;p&amp;gt;Give some info.&amp;lt;/p&amp;gt;      // optional&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;script src=&amp;quot;https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
        // Clear sessionStorage after a certain delay        &lt;br /&gt;
        if (sessionStorage.getItem(&amp;quot;setTime&amp;quot;) != &amp;quot;set&amp;quot;) {&lt;br /&gt;
            nd = new Date();&lt;br /&gt;
            lastTime = nd.getTime().toString();&lt;br /&gt;
            sessionStorage.setItem(&amp;quot;time&amp;quot;, lastTime);&lt;br /&gt;
            sessionStorage.setItem(&amp;quot;setTime&amp;quot;, &amp;quot;set&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        // Set the delay to say 5 minutes: aferXmin = 5&lt;br /&gt;
        // (Use 0.33 minutes, i.e. 20 sec, for demonstration purposes)&lt;br /&gt;
        afterXmin = 5;&lt;br /&gt;
        maxDelay = afterXmin * 60 * 1000;&lt;br /&gt;
        d = new Date();&lt;br /&gt;
        newTime = d.getTime()&lt;br /&gt;
        lastTime = sessionStorage.getItem(&amp;quot;time&amp;quot;)&lt;br /&gt;
        delay = newTime - lastTime;&lt;br /&gt;
        if (delay &amp;gt; maxDelay) {&lt;br /&gt;
            sessionStorage.clear();&lt;br /&gt;
        }&lt;br /&gt;
        // Show or hide correct or incorrect questions in the previous attempt:&lt;br /&gt;
        i = 0;&lt;br /&gt;
        $(&amp;quot;.que&amp;quot;).each(function() {&lt;br /&gt;
            i++;&lt;br /&gt;
            var x = i.toString();&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;correct&amp;quot;)) {&lt;br /&gt;
                sessionStorage.setItem(x, &amp;quot;correct&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;incorrect&amp;quot;)) {&lt;br /&gt;
                sessionStorage.setItem(x, &amp;quot;incorrect&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;answersaved&amp;quot;) &amp;amp;&amp;amp; sessionStorage.getItem(x) == &amp;quot;correct&amp;quot;) {&lt;br /&gt;
                $(this).hide();&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;answersaved&amp;quot;) &amp;amp;&amp;amp; sessionStorage.getItem(x) == &amp;quot;incorrect&amp;quot;) {&lt;br /&gt;
                $(this).show();&lt;br /&gt;
            }&lt;br /&gt;
        });&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prevent students from taking the quiz some time after its opening time===&lt;br /&gt;
&lt;br /&gt;
Suppose a quiz opens at 14:00 on April 12, 2022. You don&#039;t want students to be able to start it after 14:10. Here is one way to do it. Note that the solution below is a workaround until a custom quiz access rule plugin is developed.&lt;br /&gt;
&lt;br /&gt;
*Create a [[Label|label]] just above the quiz.&lt;br /&gt;
*In the label settings and in the &amp;quot;Label text&amp;quot;, insert a message such as &amp;quot;Click the [Mark as done] button below to access the quiz:&amp;quot;&lt;br /&gt;
*Under &amp;quot;[[Restrict access]]&amp;quot;, add a &amp;quot;Date&amp;quot; restriction &amp;quot;until 12 April 2022 14 10&amp;quot; as shown below.&lt;br /&gt;
*Under &amp;quot;[[Activity completion]]&amp;quot;, set &amp;quot;Completion tracking&amp;quot; to &amp;quot;Students can manually mark the activity as completed&amp;quot; as shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1528.png|850px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*In the quiz settings and under &amp;quot;[[Restrict access]]&amp;quot;, set an &amp;quot;[[Activity completion]]&amp;quot; to &amp;quot;Click the [Mark as done] button below to access th...  must be marked complete&amp;quot; as shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1536.png|800px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Between 14:00 and 14:10, students will see the following.&lt;br /&gt;
*If they do not click the [Mark as done] button, the quiz is not visible nor accessible:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1554.png|750px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If they click the [Mark as done] button, the quiz is visible and accessible:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1556.png|750px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After 2:10 pm, the &amp;quot;Click the [Mark as done] button below to access th...&amp;quot; label is no longer visible. So for students who have not clicked the [Mark as done] button, the quiz is no longer visible nor accessible. For students who clicked the [Mark as done] button, the quiz is accessible and remains accessible even if they temporarily quit and return to the quiz.&lt;br /&gt;
&lt;br /&gt;
You could add another [[Label|label]] with the text &amp;quot;It is past 2:10 PM so you missed the opening of the quiz. It is no longer available.&amp;quot;, with &amp;quot;Date&amp;quot; and &amp;quot;[[Activity completion]]&amp;quot; restrictions set in such a way that this label is displayed after 2:10 pm and only to students who have not clicked the [Mark as done] button.&lt;br /&gt;
&lt;br /&gt;
==Grades==&lt;br /&gt;
&lt;br /&gt;
===Why is my quiz not displaying in the gradebook?===&lt;br /&gt;
&lt;br /&gt;
Go to the editing quiz page and check that you have a maximum grade that is more than 0 - if your score is 0, then the quiz will not appear in the gradebook.&lt;br /&gt;
&lt;br /&gt;
===I&#039;ve entered quiz grades manually in the gradebook. How can I allow students to improve on these grades?===&lt;br /&gt;
&lt;br /&gt;
When a grade is entered directly in the gradebook, an &amp;quot;overridden&amp;quot; flag is set, meaning that the grade can no longer be changed from within the quiz.&lt;br /&gt;
&lt;br /&gt;
However, the flag can be removed by turning editing on in the [[Grader report|grader report]], then clicking the edit grade icon, unchecking the overridden box and saving the changes.&lt;br /&gt;
&lt;br /&gt;
===How can I set a grade to pass?===&lt;br /&gt;
&lt;br /&gt;
See the section &#039;Setting a grade to pass for a quiz&#039; in [[Activity completion settings]] for details.&lt;br /&gt;
&lt;br /&gt;
===How can I have a quiz that is not graded?===&lt;br /&gt;
&lt;br /&gt;
On the Edit quiz page, change the total score and each question&#039;s score to 0 instead of the defaults of 10 and 1 per question:&lt;br /&gt;
[[File:quizscore0.png|600px]]&lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
&lt;br /&gt;
===How can I turn off question flagging?===&lt;br /&gt;
By default, flags are available in quiz questions.&lt;br /&gt;
&lt;br /&gt;
[[File:flag.png|119px]]&lt;br /&gt;
&lt;br /&gt;
There is a capability attached to this: [[Capabilities/moodle/question:flag]]. Remove this capability from roles that you don&#039;t want to see the flags. You can either do that by editing the role definitions globally, or by overriding the permissions in just one quiz or course.&lt;br /&gt;
&lt;br /&gt;
===How can I hide the number of marks available for each question?===&lt;br /&gt;
&lt;br /&gt;
This is not really possible unless you are prepared to edit the code.&lt;br /&gt;
&lt;br /&gt;
If you have a custom theme, you can add CSS like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.que .info .grade { display: none; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or you could try to make it more specific, and only hide the grade before the question is answered:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.que.answersaved .info .grade,&lt;br /&gt;
.que.invalidanswer .info .grade,&lt;br /&gt;
.que.notyetanswered .info .grade { display: none; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can also add this CSS using the [[Header_and_footer|Additional HTML admin setting]].&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can alter the PHP code here: https://github.com/moodle/moodle/blob/4de51c25ae227a727dcba7c39f6f644a5d47ce7a/mod/quiz/locallib.php#L1820. Change that line to give the behaviour you want, e.g.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$options-&amp;gt;marks = self::extract($quiz-&amp;gt;reviewmarks, $when,&lt;br /&gt;
                self::MARK_AND_MAX, self::HIDDEN);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be warned that any of these approaches will affect every quiz in the Moodle site.&lt;br /&gt;
&lt;br /&gt;
===How can I delay the quiz feedback after the quiz has passed===&lt;br /&gt;
* Suppose the students take a &amp;quot;Main&amp;quot; one-hour quiz from 2 April 14:00 to 2 April 15:00. They shall not have any feedback during and after the quiz until the following week.&lt;br /&gt;
* Students take a &amp;quot;Follow up&amp;quot; quiz a week later, starting 9 April 14:00. If they succeed the &amp;quot;Follow up&amp;quot; quiz, they can then review the &amp;quot;Main&amp;quot; quiz and get their points.&lt;br /&gt;
&lt;br /&gt;
This can be done by editing the &amp;quot;Main&amp;quot; and &amp;quot;Follow up&amp;quot; quiz settings, and the Gradebook set up as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:MoodleDocs201904041052.png|280px|thumb|right]]&lt;br /&gt;
&#039;&#039;&#039;&amp;quot;Main&amp;quot; quiz settings&#039;&#039;&#039;   &#039;&#039;See also the image on the right&#039;&#039; -&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Timing&lt;br /&gt;
  Open the quiz:   2 April 14:00&lt;br /&gt;
  Close the quiz:  9 April 14:00&lt;br /&gt;
Review options&lt;br /&gt;
  During the attempt&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  Immediately after the attempt&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  Later, while the quiz is still open&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  After the quiz is closed&lt;br /&gt;
     Check feedbacks&lt;br /&gt;
Restrict access&lt;br /&gt;
  Student must match any of the following&lt;br /&gt;
     Date: until 2 April 15:00&lt;br /&gt;
     or&lt;br /&gt;
     Student must match all of the following (restriction set)&lt;br /&gt;
        Date: from 9 April 14:00&lt;br /&gt;
        and&lt;br /&gt;
        Grade: Follow up&lt;br /&gt;
          Check must be ≥ 1 %&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;quot;Follow up&amp;quot; quiz settings&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Timing&lt;br /&gt;
  Open the quiz: 9 April 14:00&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gradebook set up&#039;&#039;&#039;&lt;br /&gt;
 Main quiz: Weight 0.0, ID number &amp;quot;main&amp;quot;&lt;br /&gt;
 Follow up quiz: Weight 0.0, ID number &amp;quot;followup&amp;quot;&lt;br /&gt;
 Grade item &amp;quot;Total&amp;quot;: Weight 100.0, Calculation = [​[main]​] + [​[followup]​]  &#039;&#039;(&amp;lt;- do not copy/paste this equation, rewrite it)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Is there a way to display submitted images instead of titles of Images on the review page for the quiz?===&lt;br /&gt;
Yes. See [https://moodle.org/mod/forum/discuss.php?d=392623#p1582739 this forum post].&lt;br /&gt;
&lt;br /&gt;
==Errors==&lt;br /&gt;
&lt;br /&gt;
===I obtain the error &#039;The number of random questions required is more than are still available in the category!&#039;===&lt;br /&gt;
&lt;br /&gt;
Review your quiz and verify Moodle has enough questions from each category of questions it will be pulling from. You may have inadvertently selected more questions than what exists in the category. Also make sure you&#039;re not pulling questions from a category that has zero questions. Because you are picking random questions, rather than a specific question, it may not be apparent at first that you have run out of questions to ask!&lt;br /&gt;
&lt;br /&gt;
==Quiz plugins==&lt;br /&gt;
&lt;br /&gt;
There are a number of ways to extend quizzes, such as adding new reports and questions types. See [https://moodle.org/plugins/browse.php?list=category&amp;amp;id=28 Moodle plugins directory: Plugin type: Quiz].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Effective quiz practices]]&lt;br /&gt;
* [[Questions FAQ]]&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [https://moodle.org/mod/forum/view.php?id=737 Quiz forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Test FAQ]]&lt;br /&gt;
[[es:Examen FAQ]]&lt;br /&gt;
[[fr:FAQ sur les tests]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Quiz_FAQ&amp;diff=145168</id>
		<title>Quiz FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Quiz_FAQ&amp;diff=145168"/>
		<updated>2022-12-05T21:46:18Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Replaced &amp;lt;code&amp;gt; with &amp;lt;pre&amp;gt;/&amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz}}&lt;br /&gt;
==General==&lt;br /&gt;
===How can guests answer a Moodle quiz?===&lt;br /&gt;
&lt;br /&gt;
It is not possible for guests to use [[Activities|activities]] in Moodle.&lt;br /&gt;
&lt;br /&gt;
But you can  build a quiz on Google Forms and give a link from within Moodle.&lt;br /&gt;
&lt;br /&gt;
===How can I try a quiz before it is released?===&lt;br /&gt;
&lt;br /&gt;
You have prepared a quiz exam for your students. It is currently in a hidden state. The exam opens on the day of the exam, at a time that the students know about. However, to satisfy yourself that it is doable in the time allotted, You wish to do a dry run yourself before that date. How can You accomplish this?&lt;br /&gt;
&lt;br /&gt;
Method 1: Use the Preview feature available to you as a teacher as you are making the quiz.&lt;br /&gt;
 &lt;br /&gt;
Method 2: &lt;br /&gt;
&lt;br /&gt;
# Make a dummy account with a name like &amp;quot;Test Student&amp;quot;.&lt;br /&gt;
# Enrol that user in the course as a student.&lt;br /&gt;
# Add a &amp;quot;User override&amp;quot; to the quiz, so &amp;quot;Test Student&amp;quot; can attempt the quiz before it is open to everyone else.&lt;br /&gt;
# Log in as &amp;quot;Test student&amp;quot;.&lt;br /&gt;
# Attempt the quiz.&lt;br /&gt;
# Log back in as teacher.&lt;br /&gt;
# Review the attempt.&lt;br /&gt;
# Go to Results -&amp;gt; Grades and delete the test attempt.&lt;br /&gt;
# Un-enrol &amp;quot;Test Student&amp;quot; from your course.&lt;br /&gt;
&lt;br /&gt;
Method 3: Set up a Moodle Playground course for your teachers. Add teachers with dual role (teacher and student). Teachers can later copy the quiz/assignment/whatever over to their live class.&lt;br /&gt;
&lt;br /&gt;
===How can I enable notification of quiz submissions?===&lt;br /&gt;
&lt;br /&gt;
See [[Quiz submission notification]].&lt;br /&gt;
&lt;br /&gt;
===How do I send a bulk message to all students who haven&#039;t completed a quiz?===&lt;br /&gt;
*From your navigation block, click &#039;&#039;Reports&amp;gt;Course participation&#039;&#039;&lt;br /&gt;
*From the drop down, choose your quiz.&lt;br /&gt;
*In &#039;&#039;Show only&#039;&#039;, choose &amp;quot;Student&amp;quot; and in &#039;&#039;Actions&#039;&#039;, choose &amp;quot;post&amp;quot;&lt;br /&gt;
*In the list that appears, tick/check the boxes next to those you wish to message.&lt;br /&gt;
*In the bottom dropdown &#039;&#039;With selected users&#039;&#039;, choose &amp;quot;send message&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:quizemail.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===How can build a quiz that picks X questions randomly from a larger question bank?===&lt;br /&gt;
See the section on adding random questions in [[Building Quiz]].&lt;br /&gt;
&lt;br /&gt;
===How can I print a copy of a quiz?===&lt;br /&gt;
&lt;br /&gt;
Use your browser printer option (for example by right-clicking and selecting Print) When a student prints their finished quiz, responses and feedback will also be printed.&lt;br /&gt;
&lt;br /&gt;
[[File:browserquizprint29.png|thumb|center|400px|Print preview of finished quiz - Click to enlarge]]&lt;br /&gt;
&lt;br /&gt;
You can also export the question as Moodle XML, or GIFT format. If you open either of those files in a text-editor, you should be able to see most of the details of each question. &lt;br /&gt;
&lt;br /&gt;
=== How can I print all the students&#039; quiz questions and answers?===&lt;br /&gt;
*Two options are available:&lt;br /&gt;
** Install the [https://moodle.org/plugins/quiz_archive quiz archive report] additional plugin  - Moodle quiz report plugin to achieve archiving your test, by printing out all attempts at once.&lt;br /&gt;
** Install the [https://moodle.org/plugins/quiz_answersheets Export quiz attempts] additional plugin - This quiz report allows you to get view of a quiz attempt that is formatted for easy printing. &lt;br /&gt;
=== How can I optimize a Moodle server for performing more concurrent quizzes? ===&lt;br /&gt;
&lt;br /&gt;
See [[Performance recommendations]], also the forum discussion [https://moodle.org/mod/forum/discuss.php?d=418615 Quiz with 400+ concurrent users: what‘s best?]&lt;br /&gt;
&lt;br /&gt;
=== Can I release the answers to students who did not attempt a quiz? ===&lt;br /&gt;
Yes. One way to handle this with standard Moodle would be to open the quiz after the deadline and add a time limit to the quiz of one second. Unless students are extremely quick they will not be able to gain any points, but would see the general feedback.&lt;br /&gt;
&lt;br /&gt;
=== How can I make Moodle quizzes if my school does not have enough computers / fast internet / a good Moodle server? ===&lt;br /&gt;
* Check the [[Offline quiz activity]] additional plugin.&lt;br /&gt;
* Check the [https://moodle.org/plugins/mod_exam exam] additional plugin. It allows the teacher to build quizzes with multiple choice question based on Quiz module. Main purpose of Exam module is to improve performance of quiz and to reduce database overhead, so that a large number of users can attempt quiz simultaneously. Warning  - Technically it is possible for students to manipulate their exam grades if they know right parameters or they could see correct answers if they could read javascript objets being transmitted in their browser. Use with Caution.&lt;br /&gt;
* Read about the use of Chromebooks and iPad in the [[https://docs.moodle.org/38/en/Safe_Exam_Browser | Safe Exam Browser]] Moodle documentation for version until 3.8.&lt;br /&gt;
* Visit the page for [https://www.eventbrite.com.au/o/transforming-exams-e-exams-symposium-17431618115 Transforming Exams] - Transforming Exams is an Australian Government funded research project looking at approaches to conducting authentic digital assessment in the exam rooms of Australian universities via the use of Bring-your-own laptops. The project involves 10 Australian university partners and is lead out of Monash University. See [http://transformingexams.com/ TransformingExams.com] for project information.&lt;br /&gt;
&lt;br /&gt;
===Can I print the quiz results without the answers history?===&lt;br /&gt;
If you want to to print the results of all the student attempts, but ommit the answers history, as it might take much space, you can do so by accessing the settings on Site admin -&amp;gt; Appearance -&amp;gt; Additional HTML. In the &#039;Within head&#039; setting, put something like:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
 @media print {&lt;br /&gt;
     .que .history {&lt;br /&gt;
         display: none;&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Is it possible for a teacher to add a personal/private note to a student&#039;s quiz submission?===&lt;br /&gt;
Not really, but as a workaround, you can use the buit-in [[Notes]] feature.&lt;br /&gt;
&lt;br /&gt;
===Copying a quiz===&lt;br /&gt;
When you add questions to a quiz, you are not actually adding questions, but rather links or pointers to questions in the question bank. When you copy a quiz, two things can happen depending on where the questions are placed:&lt;br /&gt;
&lt;br /&gt;
* If the questions are placed in a question category of the quiz, for example the &amp;quot;Default category for questions shared in the quiz context&amp;quot;, the quiz is copied as well as the question category together with the questions it contains. See [[https://docs.moodle.org/402/en/Question_contexts#How_to_access_the_Quiz_activity_context How to access the Quiz activity context]].&lt;br /&gt;
* If the questions are not placed in a question category of the quiz, the quiz is copied but not the questions. However, the links to the original questions are copied. Therefore, when editing the quiz copy, you are also editing the questions of the original quiz, because the question links point to the same questions. Be careful!&lt;br /&gt;
&lt;br /&gt;
=== Can I know the marks per each section of a quiz?===&lt;br /&gt;
An additional plugin [https://moodle.org/plugins/quiz_markspersection Marks per section] does exactly that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
&lt;br /&gt;
===Why am I no longer allowed to add or remove questions?===&lt;br /&gt;
Most likely it is because you have students that have already attempted the quiz. You will need to delete all of the attempts by selecting them and choosing to delete them if you need to add/remove questions from a quiz. &lt;br /&gt;
&lt;br /&gt;
If you are developing a new quiz where the attempts have just been trials then deleting the previous attempts will have no consequences in the grade book. &lt;br /&gt;
&lt;br /&gt;
There are several ways of getting to the “attempts #” which you need to click on to delete the previous attempts. Use which ever works for you.&lt;br /&gt;
#Click on the quiz that you want to amend. It will take you to a page with “attempts #&amp;quot; at the top.&lt;br /&gt;
#If you are on a page with this message “You cannot add or remove questions because the quiz has been attempted (attempts #)” Click on &amp;quot;attempts #&amp;quot;.&lt;br /&gt;
#If you have navigated away from the page with the message go to the Settings block &amp;gt; Quiz Administration &amp;gt; Edit Quiz.&lt;br /&gt;
Whichever way you find “attempts #” click on it and you will go to a page with a drop down menu at the top. Select “all users who have attempted the quiz”. There are several other click boxes select whatever applies to your situation.&lt;br /&gt;
Click “Show Report” and then “select all”. Click “Delete selected attempts” and confirm selection.&lt;br /&gt;
&lt;br /&gt;
Go back to  Quiz Administration &amp;gt; Edit Quiz and you will now be able to add or delete questions.&lt;br /&gt;
&lt;br /&gt;
===How can I remove a problem question after the quiz has been taken?===&lt;br /&gt;
&lt;br /&gt;
You can not remove a question once a quiz has been taken by one student or more. However you can change the score and flag the question so you know it has problems.&lt;br /&gt;
&lt;br /&gt;
Set the score for that question to 0. &lt;br /&gt;
*Caution: In some versions of Moodle if you use this question in an other quiz, this will potentially change the question in that quiz as well. A trick is to score the question as 0, then regrade the just completed quiz. This will establish the new grade for gradebook.  Now go back and change the score to the original value.  &lt;br /&gt;
&lt;br /&gt;
Find the question in Question Bank.  Maybe edit the title (e.g. &#039;Do not use in Bio101&#039;).  Or if you do not share the question category with other teachers, create a sub category, move the offending question there, and perhaps create a better question to replace the one you just moved.  Create a new quiz and if necessary hide the old one.&lt;br /&gt;
*Caution: if other departments or teachers use a question category it might be wise to check with the team before moving or changing any question.   This is one reason importing questions in a course is a good best practice in some situations.&lt;br /&gt;
&lt;br /&gt;
===How can I turn off glossary auto-linking in a quiz? ===&lt;br /&gt;
*In the Quiz administration settings block there will be a link &amp;quot;filter&amp;quot;.&lt;br /&gt;
*Click the link and you will have the option to disable filters just for that particular quiz:&lt;br /&gt;
&lt;br /&gt;
===Can I make a second quiz start right away after a first quiz is finished?===&lt;br /&gt;
By using a hack (See [https://moodle.org/mod/forum/discuss.php?d=377382 this forum thread]). &lt;br /&gt;
&lt;br /&gt;
In the &#039;Overall feedback&#039; for the first quiz, add some code which redirects to the second quiz. Make a big button to make that obvious:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;div style=&amp;quot;text-align:center;padding:20px;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;a href=&amp;quot;https://--your domain--/mod/quiz/view.php?id=--quiz 2 no--&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button type=&amp;quot;button&amp;quot; style=&amp;quot;height:100px;font-size:24px;&amp;quot;&amp;gt;Click here to access Quiz 2&amp;lt;/button&amp;gt;&lt;br /&gt;
  &amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It would look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Click here to access Quiz 2.png|200px]]&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* The button will not appear in the gradebook.&lt;br /&gt;
* In the quiz settings and under Review options, select &#039;Overall feedback&#039; under &#039;Immediately after the attempt&#039;. Deselect &#039;Overall feedback&#039; under &#039;Later, while the quiz is still open&#039; and &#039;After the quiz is closed&#039;.&lt;br /&gt;
&lt;br /&gt;
===Prevent entry to a quiz some time after its start===&lt;br /&gt;
Suppose a quiz is set to open at 13:00 and the time limit is set to 45 minutes or some other value. Students have to enter the quiz from 13:00 to 13:15, otherwise they should not be able to do so. Proceed as follows to prevent students from entering the quiz after 13:15.&lt;br /&gt;
&lt;br /&gt;
Create another quiz, let&#039;s call it an &#039;entry&#039; quiz, containing a simple multiple choice, true or false, or short answer question, such as &amp;quot;Do you want to take the quiz? Y or N&amp;quot; or any other similar question. Tell students that they must answer and &amp;quot;Submit all and finish&amp;quot; in order to access the main quiz. In the settings of this entry quiz, set &amp;quot;Open the quiz&amp;quot; to 13:00 and &amp;quot;Close the quiz&amp;quot; to 13:15, that is, it is only open for the first 15 minutes.&lt;br /&gt;
&lt;br /&gt;
In the main quiz settings and under &amp;quot;Restrict access&amp;quot;, add a &amp;quot;Grade&amp;quot; restriction and select the entry quiz. If you do not specify a grade, the restriction is satisfied regardless of the grade obtained in the entry quiz.&lt;br /&gt;
&lt;br /&gt;
You can also add &amp;quot;Date&amp;quot; restrictions to both the entry quiz and the main quiz to control their display.&lt;br /&gt;
&lt;br /&gt;
Thus, punctual students will have access to the entry quiz from 13:00 to 13:15 and therefore to the main quiz throughout its 45 minutes duration. Latecomers will not have access to the entry quiz after 13:15 and therefore they will not be able to access the main quiz at all.&lt;br /&gt;
&lt;br /&gt;
==Attempts==&lt;br /&gt;
&lt;br /&gt;
===How can I give particular students extra time or numbers of attempts?===&lt;br /&gt;
*In the Quiz administration there is a link &amp;quot;User overrides&amp;quot;&lt;br /&gt;
*Click this link and you will be able to choose one or more users and change quiz dates, times or number of attempts.&lt;br /&gt;
&lt;br /&gt;
[[File:quizuseroverride.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Can I have different start times/timings/numbers of attempts for different groups?===&lt;br /&gt;
*In the Quiz administration settings block, there is a link &amp;quot;group overrides&amp;quot; that allows you to do things like grant extensions to certain groups of students.&lt;br /&gt;
*Click this link and you will be able to select your groups and change the quiz dates, times and number of attempts:&lt;br /&gt;
&lt;br /&gt;
[[File:quizgroupoverride.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===What happens if students submit answers after the quiz closing date?===&lt;br /&gt;
It is possible for students to still submit answers after the quiz has closed (for example if they started the attempt before the closing date but then took a long time before submitting). These responses are stored by the quiz module, but the students are not given any credit for them. The teacher can see these answers when reviewing the student&#039;s attempts and can give the student credit for them by manually entering a grade in the gradebook. Also the teacher could change the closing date after the fact and regrade the attempts. The students&#039; answers would then get graded.&lt;br /&gt;
&lt;br /&gt;
===How can a &amp;quot;Never submitted quiz&amp;quot; attempt be submitted?===&lt;br /&gt;
Currently  there is no way to retrieve an attempt that was &amp;quot;Never Submitted&amp;quot;, and get it back into the &amp;quot;In progress&amp;quot; state. Perhaps the best solution is to plan ahead and set your quiz to set your quiz to be submitted automatically.  Alternatively, you can&lt;br /&gt;
# Update the quiz : set the &amp;quot;close the quiz&amp;quot; date after today&lt;br /&gt;
# Set &amp;quot;When time expires&amp;quot; to &amp;quot;There is a grace period ...&amp;quot;&lt;br /&gt;
#Under Grade set &amp;quot;Attempts allowed&amp;quot; to &amp;quot;unlimited&amp;quot;&lt;br /&gt;
#Question behavior: Each attempt builds on the last &amp;quot;Yes&amp;quot;&lt;br /&gt;
# Invite the students who did not close their exams&lt;br /&gt;
# Allow them to start a new attempt, and close it immediately.&lt;br /&gt;
&lt;br /&gt;
===Why can&#039;t people (guests) attempt a quiz without creating an account and logging in?===&lt;br /&gt;
&lt;br /&gt;
This is difficult to implement for technical reasons.&lt;br /&gt;
&lt;br /&gt;
To explain: The quiz has to link all information about an attempt to a particular &#039;user&#039; record in the database, and each user can only have one open quiz attempt at a time. All not-logged-in users share the same &#039;guest&#039; user database record. Therefore, two guests could not attempt the quiz at the same time, and even if they could, it would be difficult to prevent one guest seeing another guest&#039;s attempts.&lt;br /&gt;
&lt;br /&gt;
Of course, given enough work, it would be possible to change some of those assumptions, and so make it possible for guests to attempt quizzes. Indeed, some of the obstructions to implementing this have already been removed while doing other work on the quiz, but there is still some way to go. If you would like to see this implemented, please vote for MDL-17892.&lt;br /&gt;
&lt;br /&gt;
A workaround is to create a visitor account, say with username = guest,  password = visitor, for everyone to share.&lt;br /&gt;
&lt;br /&gt;
===How can I prevent a student from reviewing or jumping around questions in a quiz?===&lt;br /&gt;
You can block the quiz navigation block and the summary of quiz page with CSS code in a theme.   However, if a student fails to answer a question, they will not know if you implement this &amp;quot;solution&amp;quot;. Also if others on the site do not want this patch, make sure the theme you select for the course is not used by others.&lt;br /&gt;
&lt;br /&gt;
For example using the Afterburner theme, enter this in the CSS code area:&lt;br /&gt;
&lt;br /&gt;
:div#mod_quiz_navblock {visibility:hidden;}&lt;br /&gt;
:table.quizsummaryofattempt {visibility:hidden;}&lt;br /&gt;
&lt;br /&gt;
There are other CSS solutions.&lt;br /&gt;
&lt;br /&gt;
===How can I force my students to answer all the question in a quiz before they submit?===&lt;br /&gt;
&lt;br /&gt;
There are various ways to answer this:&lt;br /&gt;
# You can&#039;t.&lt;br /&gt;
# Your students are not stupid. They know they will get zero marks for any question they do not answer, so they already have a strong incentive to answer every question. Furthermore, at the end of the quiz there is the summary page where they can easily check that they have answered all the questions before they submit, so they won&#039;t accidentally miss questions.&lt;br /&gt;
# OK, so you want us to write code that won&#039;t let students submit before they have answered each question. Well, all that does is forces the student to put random junk like &amp;quot;asdf&amp;quot; into each question before they click the button, or randomly make a choice in each multiple choice question. There is no educational benefit in this. You get more meaningful information if students leave those questions blank rather than putting in random responses.&lt;br /&gt;
&lt;br /&gt;
=== Can I force a user to reattempt only incorrect questions in subsequent attempts?===&lt;br /&gt;
&lt;br /&gt;
The easiest way to implement this solution is to use javascript or modify the source code on your Moodle site. The javascript solution described in [https://moodle.org/mod/forum/discuss.php?d=395125 this forum thread] is as follows:&lt;br /&gt;
&lt;br /&gt;
* Insert the following code in the HTML of the text of a description question.&lt;br /&gt;
* Include this description question in the quizzes. If the quizzes are displayed on multiple pages, add the description question on each page.&lt;br /&gt;
* If you are using the [[Adaptable theme]] you can put the JS in the JS section of the [[Adaptable theme]]. With the standard [[Boost theme]] or [[Classic theme]] place the script in the Site Administration / Appearance / Additional HTML section. This way you don&#039;t have to include the script in every quiz.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;h3&amp;gt;Title of the quiz&amp;lt;/h3&amp;gt;  // optional&lt;br /&gt;
&amp;lt;p&amp;gt;Give some info.&amp;lt;/p&amp;gt;      // optional&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;script src=&amp;quot;https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
        // Clear sessionStorage after a certain delay        &lt;br /&gt;
        if (sessionStorage.getItem(&amp;quot;setTime&amp;quot;) != &amp;quot;set&amp;quot;) {&lt;br /&gt;
            nd = new Date();&lt;br /&gt;
            lastTime = nd.getTime().toString();&lt;br /&gt;
            sessionStorage.setItem(&amp;quot;time&amp;quot;, lastTime);&lt;br /&gt;
            sessionStorage.setItem(&amp;quot;setTime&amp;quot;, &amp;quot;set&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        // Set the delay to say 5 minutes: aferXmin = 5&lt;br /&gt;
        // (Use 0.33 minutes, i.e. 20 sec, for demonstration purposes)&lt;br /&gt;
        afterXmin = 5;&lt;br /&gt;
        maxDelay = afterXmin * 60 * 1000;&lt;br /&gt;
        d = new Date();&lt;br /&gt;
        newTime = d.getTime()&lt;br /&gt;
        lastTime = sessionStorage.getItem(&amp;quot;time&amp;quot;)&lt;br /&gt;
        delay = newTime - lastTime;&lt;br /&gt;
        if (delay &amp;gt; maxDelay) {&lt;br /&gt;
            sessionStorage.clear();&lt;br /&gt;
        }&lt;br /&gt;
        // Show or hide correct or incorrect questions in the previous attempt:&lt;br /&gt;
        i = 0;&lt;br /&gt;
        $(&amp;quot;.que&amp;quot;).each(function() {&lt;br /&gt;
            i++;&lt;br /&gt;
            var x = i.toString();&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;correct&amp;quot;)) {&lt;br /&gt;
                sessionStorage.setItem(x, &amp;quot;correct&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;incorrect&amp;quot;)) {&lt;br /&gt;
                sessionStorage.setItem(x, &amp;quot;incorrect&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;answersaved&amp;quot;) &amp;amp;&amp;amp; sessionStorage.getItem(x) == &amp;quot;correct&amp;quot;) {&lt;br /&gt;
                $(this).hide();&lt;br /&gt;
            }&lt;br /&gt;
            if ($(this).hasClass(&amp;quot;answersaved&amp;quot;) &amp;amp;&amp;amp; sessionStorage.getItem(x) == &amp;quot;incorrect&amp;quot;) {&lt;br /&gt;
                $(this).show();&lt;br /&gt;
            }&lt;br /&gt;
        });&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prevent students from taking the quiz some time after its opening time===&lt;br /&gt;
&lt;br /&gt;
Suppose a quiz opens at 14:00 on April 12, 2022. You don&#039;t want students to be able to start it after 14:10. Here is one way to do it. Note that the solution below is a workaround until a custom quiz access rule plugin is developed.&lt;br /&gt;
&lt;br /&gt;
*Create a [[Label|label]] just above the quiz.&lt;br /&gt;
*In the label settings and in the &amp;quot;Label text&amp;quot;, insert a message such as &amp;quot;Click the [Mark as done] button below to access the quiz:&amp;quot;&lt;br /&gt;
*Under &amp;quot;[[Restrict access]]&amp;quot;, add a &amp;quot;Date&amp;quot; restriction &amp;quot;until 12 April 2022 14 10&amp;quot; as shown below.&lt;br /&gt;
*Under &amp;quot;[[Activity completion]]&amp;quot;, set &amp;quot;Completion tracking&amp;quot; to &amp;quot;Students can manually mark the activity as completed&amp;quot; as shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1528.png|850px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*In the quiz settings and under &amp;quot;[[Restrict access]]&amp;quot;, set an &amp;quot;[[Activity completion]]&amp;quot; to &amp;quot;Click the [Mark as done] button below to access th...  must be marked complete&amp;quot; as shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1536.png|800px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Between 14:00 and 14:10, students will see the following.&lt;br /&gt;
*If they do not click the [Mark as done] button, the quiz is not visible nor accessible:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1554.png|750px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If they click the [Mark as done] button, the quiz is visible and accessible:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:6px solid #eee;&amp;quot;&amp;gt;[[{{ns:file}}:MoodleDocs_20210412_1556.png|750px]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After 2:10 pm, the &amp;quot;Click the [Mark as done] button below to access th...&amp;quot; label is no longer visible. So for students who have not clicked the [Mark as done] button, the quiz is no longer visible nor accessible. For students who clicked the [Mark as done] button, the quiz is accessible and remains accessible even if they temporarily quit and return to the quiz.&lt;br /&gt;
&lt;br /&gt;
You could add another [[Label|label]] with the text &amp;quot;It is past 2:10 PM so you missed the opening of the quiz. It is no longer available.&amp;quot;, with &amp;quot;Date&amp;quot; and &amp;quot;[[Activity completion]]&amp;quot; restrictions set in such a way that this label is displayed after 2:10 pm and only to students who have not clicked the [Mark as done] button.&lt;br /&gt;
&lt;br /&gt;
==Grades==&lt;br /&gt;
&lt;br /&gt;
===Why is my quiz not displaying in the gradebook?===&lt;br /&gt;
&lt;br /&gt;
Go to the editing quiz page and check that you have a maximum grade that is more than 0 - if your score is 0, then the quiz will not appear in the gradebook.&lt;br /&gt;
&lt;br /&gt;
===I&#039;ve entered quiz grades manually in the gradebook. How can I allow students to improve on these grades?===&lt;br /&gt;
&lt;br /&gt;
When a grade is entered directly in the gradebook, an &amp;quot;overridden&amp;quot; flag is set, meaning that the grade can no longer be changed from within the quiz.&lt;br /&gt;
&lt;br /&gt;
However, the flag can be removed by turning editing on in the [[Grader report|grader report]], then clicking the edit grade icon, unchecking the overridden box and saving the changes.&lt;br /&gt;
&lt;br /&gt;
===How can I set a grade to pass?===&lt;br /&gt;
&lt;br /&gt;
See the section &#039;Setting a grade to pass for a quiz&#039; in [[Activity completion settings]] for details.&lt;br /&gt;
&lt;br /&gt;
===How can I have a quiz that is not graded?===&lt;br /&gt;
&lt;br /&gt;
On the Edit quiz page, change the total score and each question&#039;s score to 0 instead of the defaults of 10 and 1 per question:&lt;br /&gt;
[[File:quizscore0.png|600px]]&lt;br /&gt;
&lt;br /&gt;
==Appearance==&lt;br /&gt;
&lt;br /&gt;
===How can I turn off question flagging?===&lt;br /&gt;
By default, flags are available in quiz questions.&lt;br /&gt;
&lt;br /&gt;
[[File:flag.png|119px]]&lt;br /&gt;
&lt;br /&gt;
There is a capability attached to this: [[Capabilities/moodle/question:flag]]. Remove this capability from roles that you don&#039;t want to see the flags. You can either do that by editing the role definitions globally, or by overriding the permissions in just one quiz or course.&lt;br /&gt;
&lt;br /&gt;
===How can I hide the number of marks available for each question?===&lt;br /&gt;
&lt;br /&gt;
This is not really possible unless you are prepared to edit the code.&lt;br /&gt;
&lt;br /&gt;
If you have a custom theme, you can add CSS like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.que .info .grade { display: none; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or you could try to make it more specific, and only hide the grade before the question is answered:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.que.answersaved .info .grade,&lt;br /&gt;
.que.invalidanswer .info .grade,&lt;br /&gt;
.que.notyetanswered .info .grade { display: none; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can also add this CSS using the [[Header_and_footer|Additional HTML admin setting]].&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can alter the PHP code here: https://github.com/moodle/moodle/blob/4de51c25ae227a727dcba7c39f6f644a5d47ce7a/mod/quiz/locallib.php#L1820. Change that line to give the behaviour you want, e.g.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$options-&amp;gt;marks = self::extract($quiz-&amp;gt;reviewmarks, $when,&lt;br /&gt;
                self::MARK_AND_MAX, self::HIDDEN);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be warned that any of these approaches will affect every quiz in the Moodle site.&lt;br /&gt;
&lt;br /&gt;
===How can I delay the quiz feedback after the quiz has passed===&lt;br /&gt;
* Suppose the students take a &amp;quot;Main&amp;quot; one-hour quiz from 2 April 14:00 to 2 April 15:00. They shall not have any feedback during and after the quiz until the following week.&lt;br /&gt;
* Students take a &amp;quot;Follow up&amp;quot; quiz a week later, starting 9 April 14:00. If they succeed the &amp;quot;Follow up&amp;quot; quiz, they can then review the &amp;quot;Main&amp;quot; quiz and get their points.&lt;br /&gt;
&lt;br /&gt;
This can be done by editing the &amp;quot;Main&amp;quot; and &amp;quot;Follow up&amp;quot; quiz settings, and the Gradebook set up as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:MoodleDocs201904041052.png|280px|thumb|right]]&lt;br /&gt;
&#039;&#039;&#039;&amp;quot;Main&amp;quot; quiz settings&#039;&#039;&#039;   &#039;&#039;See also the image on the right&#039;&#039; -&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Timing&lt;br /&gt;
  Open the quiz:   2 April 14:00&lt;br /&gt;
  Close the quiz:  9 April 14:00&lt;br /&gt;
Review options&lt;br /&gt;
  During the attempt&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  Immediately after the attempt&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  Later, while the quiz is still open&lt;br /&gt;
     Uncheck feedbacks&lt;br /&gt;
  After the quiz is closed&lt;br /&gt;
     Check feedbacks&lt;br /&gt;
Restrict access&lt;br /&gt;
  Student must match any of the following&lt;br /&gt;
     Date: until 2 April 15:00&lt;br /&gt;
     or&lt;br /&gt;
     Student must match all of the following (restriction set)&lt;br /&gt;
        Date: from 9 April 14:00&lt;br /&gt;
        and&lt;br /&gt;
        Grade: Follow up&lt;br /&gt;
          Check must be ≥ 1 %&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;quot;Follow up&amp;quot; quiz settings&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Timing&lt;br /&gt;
  Open the quiz: 9 April 14:00&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gradebook set up&#039;&#039;&#039;&lt;br /&gt;
 Main quiz: Weight 0.0, ID number &amp;quot;main&amp;quot;&lt;br /&gt;
 Follow up quiz: Weight 0.0, ID number &amp;quot;followup&amp;quot;&lt;br /&gt;
 Grade item &amp;quot;Total&amp;quot;: Weight 100.0, Calculation = [​[main]​] + [​[followup]​]  &#039;&#039;(&amp;lt;- do not copy/paste this equation, rewrite it)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Is there a way to display submitted images instead of titles of Images on the review page for the quiz?===&lt;br /&gt;
Yes. See [https://moodle.org/mod/forum/discuss.php?d=392623#p1582739 this forum post].&lt;br /&gt;
&lt;br /&gt;
==Errors==&lt;br /&gt;
&lt;br /&gt;
===I obtain the error &#039;The number of random questions required is more than are still available in the category!&#039;===&lt;br /&gt;
&lt;br /&gt;
Review your quiz and verify Moodle has enough questions from each category of questions it will be pulling from. You may have inadvertently selected more questions than what exists in the category. Also make sure you&#039;re not pulling questions from a category that has zero questions. Because you are picking random questions, rather than a specific question, it may not be apparent at first that you have run out of questions to ask!&lt;br /&gt;
&lt;br /&gt;
==Quiz plugins==&lt;br /&gt;
&lt;br /&gt;
There are a number of ways to extend quizzes, such as adding new reports and questions types. See [https://moodle.org/plugins/browse.php?list=category&amp;amp;id=28 Moodle plugins directory: Plugin type: Quiz].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Effective quiz practices]]&lt;br /&gt;
* [[Questions FAQ]]&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [https://moodle.org/mod/forum/view.php?id=737 Quiz forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Test FAQ]]&lt;br /&gt;
[[es:Examen FAQ]]&lt;br /&gt;
[[fr:FAQ sur les tests]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Language_FAQ&amp;diff=144768</id>
		<title>Language FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Language_FAQ&amp;diff=144768"/>
		<updated>2022-11-02T21:38:52Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Added &amp;quot;Error writing to database when opening language pack&amp;quot; (MDL-73571)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Language}}&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
&lt;br /&gt;
=== Which is the official language for Moodle? ===&lt;br /&gt;
The [http://lang.moodle.org/mod/forum/discuss.php?d=2617 &amp;quot;official&amp;quot;] language for Moodle is actually the Australian English (&#039;&#039;hey mate!&#039;&#039;), which is 100% the same as UK English. The default language on a new installation of Moodle, unless you change it, will be this version of English, denoted by the language code &amp;quot;en&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== What do codes like &amp;quot;en&amp;quot; and &amp;quot;en_us&amp;quot;  or &amp;quot;es&amp;quot; and &amp;quot;es_mx&amp;quot; and &amp;quot;es_ve&amp;quot; mean?? ===&lt;br /&gt;
&lt;br /&gt;
These are the language codes for each language. There is a standard for these, see [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO language code list].&lt;br /&gt;
&lt;br /&gt;
The second part, &amp;quot;_us&amp;quot; or &amp;quot;_mx&amp;quot; and &amp;quot;_ve&amp;quot; for example, represent localisations of the main language for a particular country or dialect. Typically these will include variant spellings and other preferred local terminology and phrasing. So &amp;quot;es_mx&amp;quot; has spellings and idioms (and a very important [[Decimal separator]]) used in Mexican Spanish which are distinct from international Spanish. The es_ve has small differences from the international Spanish that are of significance to Moodle users in Venezuela.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;en_us&amp;quot; is the English - United States language pack; &amp;quot;en&amp;quot; is Australian English, which is practically the same as British English.&lt;br /&gt;
&lt;br /&gt;
=== I found a mistake or typo in a language pack. Or my language is only partial, much of it is still English. What do I do? ===&lt;br /&gt;
&lt;br /&gt;
Language packs have maintainers and Moodle has its own language translation toolkit, known as AMOS. Other than some core languages maintained by Moodle HQ, most languages are maintained by volunteer maintainers. &lt;br /&gt;
&lt;br /&gt;
See the [https://docs.moodle.org/dev/Translation_FAQ Translation FAQ page] for how to report issues and [https://lang.moodle.org/mod/page/view.php?id=9 the AMOS for newcomers page] for more information.&lt;br /&gt;
&lt;br /&gt;
== Default Language  ==&lt;br /&gt;
&lt;br /&gt;
=== Where can I set the default language for the site? ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Site Administration &amp;gt; Language &amp;gt; [[Language settings]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note you can only choose to set as default a Language pack that is already installed. If the language you want is not on the list, you will need to install the language pack first. See [[Language packs]].&lt;br /&gt;
&lt;br /&gt;
=== When I change to a new default language, users still have the old language. ===&lt;br /&gt;
&lt;br /&gt;
Correct. When you change to a new site default language, this does not update the language setting in the profile for already existing users. It only sets a new default for new user accounts you create from now on. &lt;br /&gt;
&lt;br /&gt;
To do updates for already existing users, you can:&lt;br /&gt;
&lt;br /&gt;
* Tell users how to change it themselves in their user profiles by setting their Preferences &amp;gt; Preferred language&lt;br /&gt;
* Use the [[Upload users]] tool to do a mass update from a csv file changing the lang field&lt;br /&gt;
* If you have access to the database, you can change this with a simple query. See [[ad-hoc contributed reports#List of users with language|here for an example]] of how to do this.&lt;br /&gt;
&lt;br /&gt;
=== When I log in, the language switches to English. Why? ===&lt;br /&gt;
&lt;br /&gt;
* For logged-in users, the language is set to the one they have set as their preferred language (Preferences &amp;gt; User account &amp;gt; Preferred language).&lt;br /&gt;
* For logged-out visitors (before they log in) the situation depends on whether the language auto-detection is enabled. They can either get the language their browser claims to be the requested one, or the site default language.&lt;br /&gt;
&lt;br /&gt;
=== I&#039;ve set a default site language, but the Moodle calendar is in English. Why? ===&lt;br /&gt;
&lt;br /&gt;
* If your Moodle calendar is not translated, then the string &#039;locale&#039; (for *nix and Mac servers) or the string &#039;localewin&#039; (for Windows servers) in the &#039;langconfig.php&#039; file is wrong (or your server is not configured to support the language). &lt;br /&gt;
* There are quite a few languages that are not supported by Windows servers and the localewin server can not be set. In that case, you have to run your Moodle on a *nix server to make the translation of your Moodle calendar work. &lt;br /&gt;
* Mac OSs have very poor locale support. &lt;br /&gt;
* See [[:dev:Translation langconfig]] for details.&lt;br /&gt;
&lt;br /&gt;
Actually, the one and only place where Moodle requires some locales to be installed on the machine is when handling date translation (according to [https://tracker.moodle.org/browse/MDL-31622 this information]).&lt;br /&gt;
&lt;br /&gt;
=== How can I disable (hide) the language dropdown menu on the site front page? ===&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language settings&#039;&#039; and un-tick the &#039;Display language menu&#039; checkbox.&lt;br /&gt;
&lt;br /&gt;
Because it is a customisation, Moodle will not erase the xx_local language files in Moodledata with an upgrade.   Moodle will upgrade any language folders it finds in the moodle/lang folder.&lt;br /&gt;
&lt;br /&gt;
==Warning message: Your server does not seem to fully support the following languages==&lt;br /&gt;
When you install or update a language pack, your server might display the following warning:&lt;br /&gt;
 Your server does not seem to fully support the following languages:&lt;br /&gt;
followed by a list of non-supported languages and the text:&lt;br /&gt;
 Instead, the global locale (en_AU.UTF-8) will be used to format certain strings such as dates and numbers.&lt;br /&gt;
[[File:Your_server_does_not_seem_to_fully_support.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* This is caused by either:&lt;br /&gt;
** a problem with the locale (Linux and Mac) or localewin (windows) setting in langconfig.php for your language pack (you can contact your language pack maintainer listed in the [https://lang.moodle.org/local/amos/credits.php translation credits]) &lt;br /&gt;
** or the configuration of your server.&lt;br /&gt;
* If you have a Linux server (or a [[MoodleBox]]), see the documentation about [https://docs.moodle.org/dev/Table_of_locales installing additional locales].&lt;br /&gt;
* If you have a Windows or a Mac Moodle server that lacks the proper locales, we can not help you :(&lt;br /&gt;
&lt;br /&gt;
* See the [https://docs.moodle.org/dev/Translation_langconfig developer&#039;s documentation]&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Language Customisation and Multi-language ==&lt;br /&gt;
&lt;br /&gt;
=== How can I change a word or phrase used in Moodle? ===&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Language &amp;gt; Language customisation&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
See [[Language customisation]] for details.&lt;br /&gt;
&lt;br /&gt;
=== How can I find where a language string is located? ===&lt;br /&gt;
&lt;br /&gt;
See the section &#039;Finding the component and string identifier&#039; in [[Language customisation]].&lt;br /&gt;
&lt;br /&gt;
===Why are my changes not saved in my MoodleCloud site?===&lt;br /&gt;
Unfortunately customising language strings is not supported in MoodleCloud. (The same string cache is used for all sites and is read-only.)&lt;br /&gt;
&lt;br /&gt;
=== Why are my changes not saved if I edit a language pack with the Moodle language pack editor? ===&lt;br /&gt;
&lt;br /&gt;
This could be caused by the caching on the server. Language strings are cached into server memory for performance reasons and when you save changes, they may not be immediately picked up. First, refresh your own browser cache to refresh the pages from the site. Then if the strings are still not there, an administrator can purge the cache of the server.&lt;br /&gt;
&lt;br /&gt;
Another possibility is editing one language pack but testing with another. For more possibilities, see the discussion [https://moodle.org/mod/forum/discuss.php?d=429283 Dashboard &amp;quot;Timeline Block&amp;quot; Strings].&lt;br /&gt;
&lt;br /&gt;
===How can I provide course content in more than one language?===&lt;br /&gt;
&lt;br /&gt;
Labels, web pages, activity descriptions etc. may be provided in more than one language using the [[Multi language content|Multi language content filter]]. &lt;br /&gt;
&lt;br /&gt;
Another option is to create activities in different languages and restrict access to them using the [https://moodle.org/plugins/availability_language Restriction by language plugin].&lt;br /&gt;
&lt;br /&gt;
See the discussion [https://moodle.org/mod/forum/discuss.php?d=383302 Multiple Languages] for further options.&lt;br /&gt;
&lt;br /&gt;
===How can I provide course headings in more than one language?===&lt;br /&gt;
&lt;br /&gt;
Set the multi language content filter to apply to content AND headings in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Filters &amp;gt; Manage filters&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Are there any short cuts for editing a language?===&lt;br /&gt;
Yes, but be careful.  You can make use of the customise language process.  Basically copy the php files that contain the strings you want to change to the moodledata/lang/local folder.   For example, copy the /lang/en/moodle.php file to someplace.  Edit the file with a search and replace with whole word and case sensitive turned on, change Teacher to Instructor and Teachers to Instructors, do the same for teacher and teachers.  Now copy that saved copy of the moodle.php file to the  moodledata/lang/en_local folder.   Be careful not to change the String name. &lt;br /&gt;
&lt;br /&gt;
===Is it possible to customise language strings per theme?===&lt;br /&gt;
Not by default, as when strings are customised, they are customised for the whole site. However, it is possible to make a new language  pack based on your main language and apply that pack to the course which has the theme. See this forum post for more information: https://moodle.org/mod/forum/discuss.php?d=220671&lt;br /&gt;
&lt;br /&gt;
===Is it possible to use a translation extension in the browser to display a Moodle site in another language===&lt;br /&gt;
Yes, according to [https://moodle.org/mod/forum/discuss.php?d=414236#p1669886 this forum post]:&lt;br /&gt;
&lt;br /&gt;
* For Firefox:&lt;br /&gt;
** Install the [https://www.mozilla.org/en-US/exp/firefox/new/ Firefox brower] if not already installed on your computer.&lt;br /&gt;
** Open Firefox.&lt;br /&gt;
** Go to Firefox [https://addons.mozilla.org/en-US/firefox/ Browser Add-ons].&lt;br /&gt;
** Search the [https://addons.mozilla.org/en-US/firefox/addon/traduzir-paginas-web/ Translate Web Pages extension], by Filipe Ps, and add it to Firefox.&lt;br /&gt;
** Follow the instructions for this extension.&lt;br /&gt;
&lt;br /&gt;
* For Chrome:&lt;br /&gt;
** Install [https://www.google.com/intl/en/chrome/ Google Chrome] if not already installed on your computer.&lt;br /&gt;
** Open Chrome.&lt;br /&gt;
** From the Google Web Store, install the [https://chrome.google.com/webstore/detail/google-translate/aapbdbdomjkkjkaonfhkkikfgjllcleb?utm_source=chrome-ntp-icon Google Translate extension].&lt;br /&gt;
** Turn translation on by following [https://www.howtogeek.com/407924/how-to-turn-translation-on-or-off-in-chrome/ these steps] (from How-To Geek).&lt;br /&gt;
&lt;br /&gt;
===Is it possible to change the logo according to language selected, similar to multi-language content?===&lt;br /&gt;
Yes. See [https://moodle.org/mod/forum/discuss.php?d=345919 this forum thread]&lt;br /&gt;
&lt;br /&gt;
===Error writing to database when opening language pack===&lt;br /&gt;
If you get the message &amp;quot;Error writing to database&amp;quot; after clicking &#039;&#039;Open language pack for editing&#039;&#039; you probably don&#039;t have full Unicode support set up in MySQL or MariaDB. Check [[Environment|the Environment report]] to see if the mysql_full_unicode_support warning appears. If so [[MySQL_full_unicode_support|follow the steps to enable full Unicode support]] in your database.&lt;br /&gt;
&lt;br /&gt;
== Other Language Questions ==&lt;br /&gt;
&lt;br /&gt;
===Will installing several language packs decrease my server performance?===&lt;br /&gt;
Installing many (20+) language packs have [https://moodle.org/mod/forum/discuss.php?d=241098 almost 0 impact] on Moodle performance. A copy of the language packs installed are stored in your site&#039;s local /mooodledata directory. Also, actively used language strings are cached in memory by your server as well to help performance, so as long as your server has sufficient RAM there will be no impact from having many language packs installed.&lt;br /&gt;
&lt;br /&gt;
=== What is this Pirate version of English doing on my site? ===&lt;br /&gt;
&lt;br /&gt;
It has become something of a custom in the Moodle community over the years to observe [https://en.wikipedia.org/wiki/International_Talk_Like_a_Pirate_Day &#039;Talk Like a Pirate Day&#039;] (September 19) by temporarily changing the language of a site to allow the English - Pirate (en_ar) language pack. See the discussion [https://moodle.org/mod/forum/discuss.php?d=132888 here] for more.&lt;br /&gt;
&lt;br /&gt;
===Lang pack download failed with &#039;HTTP response code: HTTP/1.1 404 Not Found&#039; after new release ===&lt;br /&gt;
&lt;br /&gt;
After we branch for a new release, Moodle will try and download the new version of lang packs, however for a while development is on-sync and no new language string differences will be introduced between the two branches. During this period, AMOS is not branched and so Moodle will fail to download new language packs.&lt;br /&gt;
&lt;br /&gt;
This is expected and it will be resolved once AMOS is opened up for new changes in the new version. See MDL-34028 for example.&lt;br /&gt;
&lt;br /&gt;
===Why do the characters for my language (not English) show up as hollow squares ?===&lt;br /&gt;
&lt;br /&gt;
[[File:Language_pack_name_not_displayed.png|400px]]&lt;br /&gt;
&lt;br /&gt;
This problem may be caused by a missing/wrong character set or using a font that does not support the character map needed (see [https://moodle.org/mod/forum/discuss.php?d=327521 this forum thead]).&lt;br /&gt;
&lt;br /&gt;
[[File:Language pack name is displayed.png|400px]]&lt;br /&gt;
&lt;br /&gt;
===Are there statistics for language packs downloads?===&lt;br /&gt;
Yes. There are download stats for the past 60 days at [https://download.moodle.org/local/downloadmoodleorg/stats.php Moodle downloads stats]. See under Languages a long list of the different packs that have been downloaded:&lt;br /&gt;
[[File:Language packs downloads stats.png]]&lt;br /&gt;
&lt;br /&gt;
===Is it possible to streamline the translation of a Moodle course?===&lt;br /&gt;
Kind of... See [https://docs.moodle.org/dev/Translation#Translating_a_Moodle_course Translating a Moodle course] in the developer&#039;s documentation.&lt;br /&gt;
&lt;br /&gt;
===Can I disable google page translation on my Moodle site?===&lt;br /&gt;
Yes, according to [https://moodle.org/mod/forum/discuss.php?d=419424#p1690452 this post]:&lt;br /&gt;
 The general answer is to add translate=&amp;quot;no&amp;quot; to the html tag of your page, but that requires a code change.&lt;br /&gt;
 So the Moodle html-page starts with (source https://stackoverflow.com/questions/12238396/how-to-disable-google-translate-from-html-in-chrome)&lt;br /&gt;
 There are more options in the source discussion that are finer to control.&lt;br /&gt;
 In moodle/admin/settings.php?section=additionalhtml, you can add in the section&lt;br /&gt;
 &amp;lt;meta name=&amp;quot;google&amp;quot; content=&amp;quot;notranslate&amp;quot; /&amp;gt;&lt;br /&gt;
 and that should stop Google chrome to translate...&lt;br /&gt;
===Can I add another language key to my Windows PC?===&lt;br /&gt;
Yes. If you have an English keyboard in your PC, but you want to write Spanish words like &amp;quot;Hasta mañana&amp;quot; and you need to type the &#039;ñ&#039; letter, see [https://support.microsoft.com/en-us/windows/manage-the-input-and-display-language-settings-in-windows-10-12a10cb4-8626-9b77-0ccb-5013e0c7c7a2 this link].&lt;br /&gt;
&lt;br /&gt;
===Can I get Closed Captions in languages other than English for Moodle HQ videos in YouTube?===&lt;br /&gt;
&#039;&#039;&#039;Note: In September 2020, YouTube disabled community contributed subtitles.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For the Moodle HQ videos on Moodle 4.0 available in https://www.youtube.com/playlist?list=PLxcO_MFWQBDcI0BezfCOW8QRfJw6FblRn the user can choose to have automatically generated closed captions being automatically translated to a user language different from English.&lt;br /&gt;
&lt;br /&gt;
The user watching a YouTube video must choose the cog symbol, choose Autotranslate and choose the target language. Obviously the CC icon must be activated for the auto-translated closed captions to be shown in these YouTube videos.&lt;br /&gt;
[[File:1280px-CC_autotranslated.png]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=131927#p604462 Edited Strings Not Visible]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=316623#unread Months names in Arabic language pack]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=395788#p1595968 Multilingual moodle]&lt;br /&gt;
&lt;br /&gt;
* MDL-57867 - Email notification language strings lose line breaks when customised bug&lt;br /&gt;
&lt;br /&gt;
==Any further questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?f=26 Languages forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[fr:FAQ de langue]]&lt;br /&gt;
[[de:Sprache FAQ]]&lt;br /&gt;
[[es:Idioma FAQ]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=NTLM_authentication&amp;diff=144767</id>
		<title>NTLM authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=NTLM_authentication&amp;diff=144767"/>
		<updated>2022-11-02T11:09:46Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Using the NTLM part of Samba for Apache on Linux */ Change &amp;lt;code&amp;gt; to &amp;lt;pre&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}This document describes how to set up &#039;&#039;&#039;NTLM/Windows Integrated Authentication&#039;&#039;&#039; in Moodle. &lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
Integrated Windows Authentication uses the security features of Windows clients and servers. It does not prompt users for a user name and password. The current Windows user information on the client computer is supplied by the browser through a challenge/response authentication process with the Web server for the Moodle site. &lt;br /&gt;
&lt;br /&gt;
==Assumptions==&lt;br /&gt;
&lt;br /&gt;
#You are running MS [[Active Directory]] for Authentication.&lt;br /&gt;
#The Server hosting your website is a member of the Active Directory Domain that your users are also members of.&lt;br /&gt;
#You are able to define people inside your Network (and authenticated to the Domain) from an IP range of computers.&lt;br /&gt;
#You are familiar with or have read the LDAP authentication documentation.&lt;br /&gt;
#The Active Directory domain credentials of your users are returned as &#039;&#039;&#039;DOMAINNAME\username&#039;&#039;&#039; from your authentication service. If you are using the Winbind service from the Samba project, this can be untrue, depending on your Winbind configuration settings. If you are using Moodle 2.4 or later, you can specify the format of the domain credentials (see below). If you are using an older version and you can not modify your settings to satisfy this last assumption, then you will need to remove or comment out the line that reads:&lt;br /&gt;
    $username = substr(strrchr($username, &#039;\\&#039;), 1); //strip domain info&lt;br /&gt;
and add the relevant lines of code to extract the username part from the domain user credentials and store it in $username.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;VERY IMPORTANT&#039;&#039;&#039;: NTLM authentication depends on [[LDAP authentication]], and NTLM configuration is specified in the LDAP authentication settings page (Site Administration &amp;gt;&amp;gt; Plugins &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; LDAP Server). So before trying to configure NTLM, make sure you have LDAP_authentication properly setup and working.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
No installation needed. See Site Administration &amp;gt;&amp;gt; Plugins &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; LDAP Server for the NTLM config options. You only have to&lt;br /&gt;
&lt;br /&gt;
*Enable NTLM SSO&lt;br /&gt;
*Set the IP/Subnet mask for the clients (see below)&lt;br /&gt;
*(Optionally) Set the &amp;quot;Remote username format&amp;quot; for your domain user credentials format (see below)&lt;br /&gt;
*On IIS: turn on Windows Authentication&lt;br /&gt;
*On Apache - use one of the 4 methods outlined below&lt;br /&gt;
*On the client pc&#039;s, you might need to set the moodle server ip/moodle url as being in &amp;quot;local intranet&amp;quot; (for example, in Internet Explorer: tools -&amp;gt; options -&amp;gt; security -&amp;gt; local intranet)&lt;br /&gt;
&lt;br /&gt;
It is important to note the following conditions must be satisfied to let NTLM SSO happen:&lt;br /&gt;
*you&#039;ve arrived to the login page with one GET request&lt;br /&gt;
*you&#039;ve ldap-&amp;gt;ntlmsso_enabled&lt;br /&gt;
*you&#039;ve ldap-&amp;gt;ntlmsso_subnet&lt;br /&gt;
*you aren&#039;t logged&lt;br /&gt;
*the IP of the client is in ntlmsso_subnet&lt;br /&gt;
&lt;br /&gt;
Thus it is needed to set the IP subnet.&lt;br /&gt;
&lt;br /&gt;
==How to Turn Integrated Authentication on==&lt;br /&gt;
The &amp;lt;tt&amp;gt;auth/ldap/ntlmsso_magic.php&amp;lt;/tt&amp;gt; file MUST have NTLM/Integrated Authentication enabled on the server or the authentication will not work.&lt;br /&gt;
&lt;br /&gt;
===IIS Configuration===&lt;br /&gt;
Open the IIS Management Console and navigate to the auth/ldap/ntlmsso_magic.php file.&lt;br /&gt;
&lt;br /&gt;
====IIS 6.0====&lt;br /&gt;
#right click on the file, choose properties&lt;br /&gt;
#under the &amp;quot;file security&amp;quot; tab, click on the Authentication and Access control &amp;quot;edit&amp;quot; button&lt;br /&gt;
#untick &amp;quot;Enable Anonymous Access&amp;quot; and tick &amp;quot;Integrated Windows Authentication&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====IIS 7.x====&lt;br /&gt;
#After navigating to the &#039;auth/ldap&#039; folder, switch to Content View&lt;br /&gt;
#right click on the file, choose &amp;quot;Switch to Features View&amp;quot;&lt;br /&gt;
#click on the Authentication icon on the right&lt;br /&gt;
#select &#039;Anonymous Authentication&#039; and click the &#039;Disable&#039; button&lt;br /&gt;
#select &#039;Windows Authentication&#039; and click the &#039;Enable&#039; button&lt;br /&gt;
&lt;br /&gt;
*According to [http://moodle.org/mod/forum/discuss.php?d=145171#p634027 this post], if you are using IIS 7.5 (it comes with Windows Server 2008 R2), you have to select &#039;Windows Authentication&#039; and click on &#039;Providers&#039;. This shows a list of enabled providers (Negotiate and NTLM, by default). Change the order so that NTLM is at the top of the list.&lt;br /&gt;
*If &#039;Windows Authentication&#039; is not available, then you need to install it as a separate authentication provider (in Control Panel).&lt;br /&gt;
&lt;br /&gt;
===APACHE Configuration===&lt;br /&gt;
There are currently 4 possible methods for this:&lt;br /&gt;
&lt;br /&gt;
====Using the NTLM part of Samba for Apache on Linux====&lt;br /&gt;
* If using Ubuntu 12.04 or higher you can install this using:&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt-get install php5-ldap libapache2-mod-auth-ntlm-winbind winbind smbfs smbclient samba&lt;br /&gt;
 $ sudo a2enmod auth_ntlm_winbind &lt;br /&gt;
 $ sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
Note: On Ubuntu 14.04 smbfs has been replaced with &#039;&#039;&#039;cifs-utils&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* If you are using an earlier version of Ubuntu or another distribution you can get the plugin here: http://samba.org/ftp/unpacked/lorikeet/mod_auth_ntlm_winbind/ . You need to download all the files from the link, but not the &amp;lt;code&amp;gt;contrib&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;debian&amp;lt;/code&amp;gt; directories. Then follow the instructions given inside the &amp;lt;code&amp;gt;README&amp;lt;/code&amp;gt; file. If you are using Debian/Ubuntu, you can follow these [[#Compiling_mod_auth_ntlm_winbind_on_Debian.2FUbuntu|compilation instructions]].&lt;br /&gt;
* Once you have compiled it, put it inside Apache&#039;s modules subdirectory (this location depends on a number of factors, like compiling Apache yourself, using different Linux distributions packages, an so on), and load and enable the module in Apache&#039;s configuration. For example, if your Apache modules are under &amp;lt;tt&amp;gt;/usr/lib/apache2/modules&amp;lt;/tt&amp;gt;, you&#039;ll need something like this in your Apache configuration file (usually called &amp;lt;tt&amp;gt;apache2.conf&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;http2.conf&amp;lt;/tt&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;IfModule !mod_auth_ntlm_winbind.c&amp;gt;&lt;br /&gt;
       LoadModule auth_ntlm_winbind_module /usr/lib/apache2/modules/mod_auth_ntlm_winbind.so&lt;br /&gt;
   &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the Samba &amp;lt;tt&amp;gt;winbind&amp;lt;/tt&amp;gt; daemon package. This packages relies on Samba&#039;s configuration file to get some important settings (like the Windows domain name, uid and gid range mappings, and so on). In addition to that, you&#039;ll need to make your Linux/Unix machine part of the domain. Otherwise winbind won&#039;t be able to pull user and groups information from the domain controllers. You should read the Samba documentation to perform this step, but the most important part is having something like the following lines in your &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file, inside the [global] section (in addition to what you already have there):&lt;br /&gt;
&lt;br /&gt;
  workgroup = DOMAINNAME&lt;br /&gt;
  password server = *&lt;br /&gt;
  security = domain&lt;br /&gt;
  encrypt passwords = true&lt;br /&gt;
  idmap uid = 10000-20000&lt;br /&gt;
  idmap gid = 10000-20000&lt;br /&gt;
&lt;br /&gt;
: and executing the command (as root):&lt;br /&gt;
&lt;br /&gt;
  # net join DOMAINNAME -U Administrator&lt;br /&gt;
&lt;br /&gt;
: where &#039;&#039;&#039;DOMAINNAME&#039;&#039;&#039; is the NetBIOS windows domain name, and &#039;&#039;&#039;Administrator&#039;&#039;&#039; an account with enough privileges to add new machines to the domain.&amp;lt;br/&amp;gt; You&#039;ll need to type this account&#039;s password for the command to succeed.&lt;br /&gt;
&lt;br /&gt;
: In Windows environments you could also try executing the command (as root):&lt;br /&gt;
&lt;br /&gt;
  # net join DOMAINNAME -S DCSERVER -U Administrator&lt;br /&gt;
&lt;br /&gt;
: where DCSERVER is the Domain Controller server&lt;br /&gt;
&lt;br /&gt;
: Also, make sure you have disabled &amp;quot;Microsoft Network Server: digitally sign communications (always)&amp;quot; in your Domain Controllers Security Policy, unless you are using a version of Samba that can sign SMB packets.&lt;br /&gt;
&lt;br /&gt;
* Restart the &amp;lt;tt&amp;gt;winbind&amp;lt;/tt&amp;gt; service to apply the changes and test that it&#039;s running ok by executing:&lt;br /&gt;
&lt;br /&gt;
  $ wbinfo -u&lt;br /&gt;
&lt;br /&gt;
: You should get the full list of Windows domain users. If you use &#039;&#039;&#039;&amp;lt;tt&amp;gt;-g&amp;lt;/tt&amp;gt;&#039;&#039;&#039; instead, you&#039;ll get the domain groups list.&lt;br /&gt;
&lt;br /&gt;
* Check that your &amp;lt;tt&amp;gt;winbind&amp;lt;/tt&amp;gt; package installed the authentication helper command &amp;lt;tt&amp;gt;ntlm_auth&amp;lt;/tt&amp;gt;, as we&#039;ll need it later. We&#039;ll assume the helper is located at &amp;lt;tt&amp;gt;/usr/bin/ntlm_auth&amp;lt;/tt&amp;gt;. If yours is at a different location, make sure you adjust the path in the example below.&lt;br /&gt;
&lt;br /&gt;
* Add something like this to your Apache configuration file (usually called &amp;lt;tt&amp;gt;apache2.conf&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;http2.conf&amp;lt;/tt&amp;gt;). We&#039;ll assume that your Moodle &amp;lt;tt&amp;gt;$CFG-&amp;gt;dirroot&amp;lt;/tt&amp;gt; directory is located at &amp;lt;tt&amp;gt;/var/www/moodle&amp;lt;/tt&amp;gt; in the example:&lt;br /&gt;
    &amp;lt;Directory &amp;quot;/var/www/moodle/auth/ldap/&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Files ntlmsso_magic.php&amp;gt;&lt;br /&gt;
            NTLMAuth on&lt;br /&gt;
            AuthType NTLM&lt;br /&gt;
            AuthName &amp;quot;Moodle NTLM Authentication&amp;quot;&lt;br /&gt;
            NTLMAuthHelper &amp;quot;/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp&amp;quot;&lt;br /&gt;
            NTLMBasicAuthoritative on&lt;br /&gt;
            require valid-user&lt;br /&gt;
        &amp;lt;/Files&amp;gt;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
* Check the permissions of the Winbind pipe directory (Ubuntu places it under &amp;lt;tt&amp;gt;/var/run/samba/winbindd_privileged&amp;lt;/tt&amp;gt;, yours may be placed at a different location). Apache will need to be able to enter that directory, so we need to make sure it has the right permissions. So have a look at the permissions of that directory and note the name of the group assigned to it. The following example is from a Ubuntu 7.10 machine:&lt;br /&gt;
&lt;br /&gt;
  $ ls -ald /var/run/samba/winbindd_privileged&lt;br /&gt;
  drwxr-x--- 2 root winbindd_priv 60 2007-11-17 16:18 /var/run/samba/winbindd_privileged/&lt;br /&gt;
&lt;br /&gt;
:so we see the group is &amp;lt;tt&amp;gt;winbindd_priv&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Instead of modifying the directory permissions (which could break other services that use winbind) we are going to make the Apache user (&amp;lt;tt&amp;gt;www-data&amp;lt;/tt&amp;gt; in our example, but could be &amp;lt;tt&amp;gt;httpd&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;nobody&amp;lt;/tt&amp;gt;, etc.) is part of the appropriate group. Execute the following as root:&lt;br /&gt;
&lt;br /&gt;
  # adduser www-data winbindd_priv&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt; is available in Debian and Ubuntu at least. If your distribution doesn&#039;t have &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt;, you can edit &amp;lt;tt&amp;gt;/etc/group&amp;lt;/tt&amp;gt; manually to achive the same effect.&lt;br /&gt;
&lt;br /&gt;
* Stop and start the Apache service to apply the changes. Have a look at Apache&#039;s error log to see that everything is ok.&lt;br /&gt;
&lt;br /&gt;
* Couple of gotchas - in Fedora Core (and also in Redhat/Centos), keep alive is turned OFF by default in the httpd.conf - see this bug for further info: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=188138&lt;br /&gt;
simply change the line to that was:&lt;br /&gt;
 KeepAlive Off&lt;br /&gt;
to:&lt;br /&gt;
 KeepAlive On&lt;br /&gt;
and restart apache (/etc/init.d/http restart)&lt;br /&gt;
* Here are some notes from people who have the samba winbind option working&lt;br /&gt;
::-- I made it work using Ubuntu 7.04. That&#039;s what I&#039;ve used to update the documentation. [[User:Iñaki Arenaza|Iñaki Arenaza]] 10:43, 30 September 2007 (CDT)&lt;br /&gt;
::-- I have this working on Ubuntu 8.04 LTS in an RM CC4 Active Directory Domain. [[User:munk3h|Ian]] 16:31 15 December 2009 (GMT)&lt;br /&gt;
::--  Running on Ubuntu 10.04 Lucid, Apache2 got this running in no time flat with AD v6. Worth noting that if Using Iñaki Arenaza&#039;s LDAP Clone plugin, you will need to add another copy of the Directory tag in &amp;lt;tt&amp;gt;apache2.conf&amp;lt;/tt&amp;gt; pointing at the new ldap plugin. --[[User:Christopher O&amp;amp;#39;Kelly|Christopher O&amp;amp;#39;Kelly]] 10:09, 16 April 2012 (WST)&lt;br /&gt;
::-- On Ubuntu 14.04 I had to do the following to get NTLM auth working as I was getting the error &amp;quot;ntlm_auth reports Broken Helper: BH NT_STATUS_UNSUCCESSFUL NT_STATUS_UNSUCCESSFUL&amp;quot; in the Apache error logs (from [https://bugs.launchpad.net/ubuntu/+source/apache-mod-auth-ntlm-winbind/+bug/1304953 Launchpad]) [[User:ngmares|ngmares]]:&lt;br /&gt;
&lt;br /&gt;
  usermod -a -G winbindd_priv www-data&lt;br /&gt;
  chgrp winbindd_priv /var/lib/samba/winbindd_privileged&lt;br /&gt;
  ln -s /var/lib/samba/winbindd_privileged/pipe /var/run/samba/winbindd_privileged/pipe&lt;br /&gt;
&lt;br /&gt;
====Using the NTLM Auth Module for Apache on Linux====&lt;br /&gt;
The NTLM Auth module is a bit stale and even its authors suggest that you use the [[#Using_the_NTLM_part_of_Samba_for_Apache_on_Linux|NTLM part of Samba with Apache on Linux]]&lt;br /&gt;
&lt;br /&gt;
Get it from here &lt;br /&gt;
# get the Module from: http://modntlm.sourceforge.net/&lt;br /&gt;
# follow the instructions given there and inside the README that comes with the package.&lt;br /&gt;
&lt;br /&gt;
I (Iñaki Arenaza) strongly recommend using the [[#Using_the_NTLM_part_of_Samba_for_Apache_on_Linux|NTLM part of Samba with Apache on Linux]] over this module. It&#039;s better maintained, more robust and has more features.&lt;br /&gt;
&lt;br /&gt;
====Using the mod_auth_sspi Module for Apache 2 on Windows====&lt;br /&gt;
NOTE: This setup is currently being used in a live production environment, and is therefore suitable for such use provided it is correctly configured and tested.&lt;br /&gt;
&lt;br /&gt;
This is the recommended method for Apache 2 on Windows, however it will &#039;&#039;&#039;not&#039;&#039;&#039; work on Linux/UNIX systems.&lt;br /&gt;
It provides better stability and higher performance than other NTLM modules.&lt;br /&gt;
&lt;br /&gt;
* Download the mod_auth_sspi Module from: http://sourceforge.net/projects/mod-auth-sspi/. At the moment of writing this (2007.09.30), the current version is mod_auth_sspi 1.0.4, which has two different ZIP files to download:&lt;br /&gt;
&lt;br /&gt;
::* mod_auth_sspi-1.0.4-2.0.58.zip :   Use this file if you are using Apache 2.0.x.&lt;br /&gt;
::* mod_auth_sspi-1.0.4-2.2.2.zip :   Use this file if you are using Apache 2.2.x.&lt;br /&gt;
&lt;br /&gt;
If you are using an x64 version of Apache mod_auth_sspi x64 versions are available from https://www.apachehaus.net/modules/mod_auth_sspi/&lt;br /&gt;
&lt;br /&gt;
These files &#039;&#039;&#039;do not&#039;&#039;&#039; work with Apache versions 2.4.x.&lt;br /&gt;
&lt;br /&gt;
* Unzip the right file and copy mod_auth_sspi.so (it&#039;s inside &#039;&#039;&#039;bin&#039;&#039;&#039; subdirectory) to your Apache modules directory.&lt;br /&gt;
* Edit your Apache 2 configuration file (httpd.conf) to load the module.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;IfModule !mod_auth_sspi.c&amp;gt;&lt;br /&gt;
        LoadModule sspi_auth_module modules/mod_auth_sspi.so&lt;br /&gt;
    &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Choose one of the two methods below&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Method 1&#039;&#039;&#039;: This method is recommended for servers that will host a single Moodle instance. Configure NTLM from the main configuration file, add the following to httpd.conf (substitute &amp;quot;C:\moodle&amp;quot; with the path to your Moodle installation e.g. &amp;quot;C:\my-moodle&amp;quot;&lt;br /&gt;
    &amp;lt;Directory &amp;quot;C:\moodle\auth\ldap&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Files ntlmsso_magic.php&amp;gt;&lt;br /&gt;
            AuthName &amp;quot;Moodle at My College&amp;quot;&lt;br /&gt;
            AuthType SSPI&lt;br /&gt;
            SSPIAuth On&lt;br /&gt;
            SSPIOfferBasic Off&lt;br /&gt;
            SSPIAuthoritative On&lt;br /&gt;
            SSPIDomain &amp;lt;YOUR AD DOMAIN&amp;gt;&lt;br /&gt;
            require valid-user&lt;br /&gt;
        &amp;lt;/Files&amp;gt;&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Method 2&#039;&#039;&#039;: The alternative method is to use a .htaccess file&lt;br /&gt;
:This method is recommended for servers that will host multiple Moodle instances. It allows additional Moodle instances to be configured without restarting apache, and also makes the solution a little more portable. We need to add a directive to the main httpd.conf to allow configuration of authentication within .htaccess files.&lt;br /&gt;
    &amp;lt;Directory C:\moodle&amp;gt;&lt;br /&gt;
        AllowOverride AuthConfig&lt;br /&gt;
    &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:::Create a new text file named &#039;.htaccess&#039; in the directory &#039;C:\moodle\moodle\auth\ldap&#039; and add the following directives:&lt;br /&gt;
    &amp;lt;Files ntlmsso_magic.php&amp;gt;&lt;br /&gt;
        AuthName &amp;quot;Moodle at My College&amp;quot;&lt;br /&gt;
        AuthType SSPI&lt;br /&gt;
        SSPIAuth On&lt;br /&gt;
        SSPIOfferBasic Off&lt;br /&gt;
        SSPIAuthoritative On&lt;br /&gt;
        SSPIDomain mycollege.ac.uk&lt;br /&gt;
        require valid-user&lt;br /&gt;
    &amp;lt;/Files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This enables the Moodle folder to be moved to any apache webserver that is configured to allow authentication configuration through .htaccess&lt;br /&gt;
&lt;br /&gt;
Lastly for Internet Explorer 7 onwards you must also replace this line in your httpd-ssl.conf file: &lt;br /&gt;
&lt;br /&gt;
  BrowserMatch &amp;quot;.*MSIE.*&amp;quot; \ &lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
  BrowserMatch &amp;quot;.*MSIE [2-5]\..*&amp;quot; \ &lt;br /&gt;
&lt;br /&gt;
For further help and discussion: http://moodle.org/mod/forum/discuss.php?d=56565&lt;br /&gt;
&lt;br /&gt;
====Using the Kerberos Auth Module for Apache on Linux/UNIX (mod_auth_kerb)====&lt;br /&gt;
*Install and configure http://modauthkerb.sourceforge.net/&lt;br /&gt;
*Configuration of mod_auth_kerb in a Microsoft Windows Active Directory environment (AD 2003 and above) (http://www.grolmsnet.de/kerbtut/)&lt;br /&gt;
&lt;br /&gt;
Environment details in this example:&lt;br /&gt;
#&#039;&#039;&#039;Active Directory Domain:&#039;&#039;&#039; EXAMPLE.AC.UK&lt;br /&gt;
#&#039;&#039;&#039;Active Directory Domain Controller:&#039;&#039;&#039; dc.example.ac.uk&lt;br /&gt;
#&#039;&#039;&#039;Linux/UNIX web server:&#039;&#039;&#039; moodle.example.ac.uk&lt;br /&gt;
#&#039;&#039;&#039;Active Directory user account for web server service principal:&#039;&#039;&#039; moodlekerb&lt;br /&gt;
&lt;br /&gt;
Install kerberos on moodle.example.ac.uk and enter the following in krb5.conf (by default: /etc/krb5.conf)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[libdefaults]&lt;br /&gt;
    default_realm = EXAMPLE.AC.UK&lt;br /&gt;
[domain_realm]&lt;br /&gt;
    example.ac.uk = EXAMPLE.AC.UK&lt;br /&gt;
[realms]&lt;br /&gt;
     EXAMPLE.AC.UK = {&lt;br /&gt;
                      admin_server = dc.example.ac.uk&lt;br /&gt;
                      kdc          = dc.example.ac.uk&lt;br /&gt;
                    }:&lt;br /&gt;
* Test kerberos&lt;br /&gt;
Issue the following command at the shell prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$&amp;gt; kinit user@EXAMPLE.AC.UK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;user&#039; is an Active Directory account for which you know the password.&lt;br /&gt;
&lt;br /&gt;
Next, issue the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;$&amp;gt;klist&amp;lt;/pre&amp;gt;&lt;br /&gt;
If all is OK it will list the Kerberos ticket you were granted from the domain controller (KDC)&lt;br /&gt;
&lt;br /&gt;
* Create HTTP service principal for moodle.example.ac.uk&lt;br /&gt;
#Create the &#039;moodlekerb&#039; &#039;&#039;&#039;user&#039;&#039;&#039; account in Active Directory (NOT a machine account) to map to the web server service principal (HTTP/moodle.example.ac.uk@EXAMPLE.AC.UK)&lt;br /&gt;
NOTE: moodle.example.ac.uk MUST be the canonical DNS name of the server i.e. an A record (NOT a CNAME). Additionally a valid PTR (reverse DNS) record must exist and match the corresponding A record.&lt;br /&gt;
&lt;br /&gt;
#Use the ktpass.exe utility to map the service principal and create a keytab file&lt;br /&gt;
Apache requires a keytab file, which is generated with ktpass.exe on the Windows Active Directory Domain Controller.&lt;br /&gt;
Unfortunately, this component of Windows Server 2003 SP1 does not function correctly so one must obtain a hot fix: http://support.microsoft.com/kb/919557&lt;br /&gt;
&lt;br /&gt;
Run the following command on the domain controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
C:\path\to\hotfix\ktpass.exe -princ HTTP/moodle.example.ac.uk@EXAMPLE.AC.UK -mapuser EXAMPLE\moodlekerb -crypto DES-CBC-MD5 +DesOnly +setPass +rndPass -ptype KRB5_NT_PRINCIPAL -out moodle.example.ac.uk.keytab&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy C:\path\to\hotfix\moodle.example.ac.uk.keytab to the moodle web server and remember the location (/etc/httpd/moodle.example.ac.uk.keytab or similar)&lt;br /&gt;
&lt;br /&gt;
* Configure Apache / mod_auth_kerb&lt;br /&gt;
Edit the Apache configuration for the moodle host and add the following directives:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Directory /path/to/moodle/docs/auth/ldap/&amp;gt;&lt;br /&gt;
                &amp;lt;Files ntlmsso_magic.php&amp;gt;&lt;br /&gt;
                        AuthName &amp;quot;Moodle&amp;quot;&lt;br /&gt;
                        AuthType Kerberos&lt;br /&gt;
                        KrbAuthRealms EXAMPLE.AC.UK&lt;br /&gt;
                        KrbServiceName HTTP&lt;br /&gt;
                        Krb5Keytab /etc/httpd/moodle.example.ac.uk.keytab&lt;br /&gt;
                        KrbMethodNegotiate on&lt;br /&gt;
                        KrbMethodK5Passwd on&lt;br /&gt;
                        KrbAuthoritative on&lt;br /&gt;
                        require valid-user&lt;br /&gt;
                &amp;lt;/Files&amp;gt;&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring IP/Subnet Mask==&lt;br /&gt;
Subnet masks are based on binary patterns so need a bit of knowledge to understand. The best way to find out what IP/Subnet masks to use is to ask your Network Admin. &lt;br /&gt;
&lt;br /&gt;
* Just type them one after the other, separated by commas. You can use several syntaxes:&lt;br /&gt;
** Type the network-number/prefix-length combination. E.g. 192.168.1.0/24&lt;br /&gt;
** Type the network &#039;prefix&#039;, ending in a period character. E.g. 192.168.1.&lt;br /&gt;
** Type the network address range (&#039;&#039;&#039;this only works for the last address octect&#039;&#039;&#039;). E.g. 192.168.1.1-254&lt;br /&gt;
:All the three examples refer to the same subnetwork. So assuming you need to specify the following subnetworks:&lt;br /&gt;
::* 10.1.0/255.255.0.0&lt;br /&gt;
::* 10.2.0.0/255.255.0.0&lt;br /&gt;
::* 172.16.0.0/255.255.0.0&lt;br /&gt;
::* 192.168.100.0/255.255.255.240&lt;br /&gt;
:You can type:&lt;br /&gt;
 10.1.0.0/16, 10.2.0.0/16, 172.16.0.0/16, 192.168.100.0/28&lt;br /&gt;
: or:&lt;br /&gt;
  10.1.0.0/16, 10.2.0.0/16, 172.16.0.0/16, 192.168.100.240-255&lt;br /&gt;
:or even:&lt;br /&gt;
  10.1., 10.2., 172.16., 192.168.100.0/28&lt;br /&gt;
:(the last one cannot be expressed as a network &#039;prefix&#039; as the netmask does not fall on an octect boundary).&lt;br /&gt;
&lt;br /&gt;
==Configuring Domain user credentials format==&lt;br /&gt;
If you are using Moodle 2.4 and later there is a new setting that lets you configure the format of the domain user credentials, instead of using the old fixed format. The setting is called &amp;quot;Remote username format&amp;quot;. If you leave this setting empty, the default &#039;&#039;&#039;DOMAINNAME\username&#039;&#039;&#039; format will be used. You can use the optional &#039;&#039;&#039;%domain%&#039;&#039;&#039; placeholder to specify where the domain name appears, and the mandatory &#039;&#039;&#039;%username%&#039;&#039;&#039; placeholder to specify where the username appears.&lt;br /&gt;
&lt;br /&gt;
Some widely used formats are:&lt;br /&gt;
* &#039;&#039;&#039;%domain%\%username%&#039;&#039;&#039; : MS Windows default, contains the domain name, followed by a backlash character, followed by the username.&lt;br /&gt;
* &#039;&#039;&#039;%username%@%domain%&#039;&#039;&#039; : This is the same format used by Kerberos (domain name followed by an at sign, followed by the username).&lt;br /&gt;
* &#039;&#039;&#039;%domain%/%username%&#039;&#039;&#039; : Some people configure Samba+Winbind to use this format.&lt;br /&gt;
* &#039;&#039;&#039;%domain%+%username%&#039;&#039;&#039; : Some people configure Samba+Winbind to use this other format.&lt;br /&gt;
* &#039;&#039;&#039;%username%&#039;&#039;&#039; : Only contains the username, with no domain part.&lt;br /&gt;
&lt;br /&gt;
==Notes/Tips==&lt;br /&gt;
&lt;br /&gt;
#If you are using Firefox, you will need to follow these steps:&lt;br /&gt;
:*Load Firefox and type about:config in the address box. The configuration settings page should be displayed.&lt;br /&gt;
:*In the Filter box, type the word &amp;quot;ntlm&amp;quot; to filter the NTLM strings. You should see three settings displayed.&lt;br /&gt;
:*Double-click on &amp;quot;network.automatic-ntlm-auth.trusted-uris&amp;quot;.&lt;br /&gt;
:*In the box, enter the full URL of your Moodle server. For example &amp;lt;pre&amp;gt;http://moodle.mydomain.com, (the comma is important)&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*Close Firefox and restart.&lt;br /&gt;
# NTLM seems to not work at all when BASIC authentication is enabled. (this was using the Kerberos method, other ways may work)&lt;br /&gt;
# If the account in your AD management console shows like &amp;quot;First Last&amp;quot;, you better change the ldap settings parameter &#039;User Attribute&#039; from its default of {blank} / &#039;cn&#039; to &#039;sAMAccountName&#039; as indicated in [http://moodle.org/mod/forum/discuss.php?d=132364#p682173 this post]. The reason is that the cn name generally looks like &amp;quot;First Last&amp;quot;, once you done the ldap sync, the user name in moodle will be &amp;quot;first last&amp;quot;, but IE passes the account of &amp;quot;domain\first.last&amp;quot; to moodle which does not exist in moodle.&lt;br /&gt;
&lt;br /&gt;
== To get a domain name for Moodle working on IIS7.5 Windows 2008 R2 ==&lt;br /&gt;
Refer to http://support.microsoft.com/kb/896861. Key section listed below.&lt;br /&gt;
Click Start, click Run, type regedit, and then click OK.&amp;lt;br /&amp;gt;&lt;br /&gt;
In Registry Editor, locate and then click the following registry key: &lt;br /&gt;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0&amp;lt;br /&amp;gt;&lt;br /&gt;
Right-click MSV1_0, point to New, and then click Multi-String Value.&amp;lt;br /&amp;gt;&lt;br /&gt;
Type BackConnectionHostNames, and then press ENTER.&amp;lt;br /&amp;gt;&lt;br /&gt;
Right-click BackConnectionHostNames, and then click Modify.&amp;lt;br /&amp;gt;&lt;br /&gt;
In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.&amp;lt;br /&amp;gt;&lt;br /&gt;
Quit Registry Editor, and then restart the IISAdmin service.&lt;br /&gt;
&lt;br /&gt;
==Compiling mod_auth_ntlm_winbind on Debian/Ubuntu==&lt;br /&gt;
You need to install the following packages (and all of their dependencies) by using aptitude, synaptic, etc.:&lt;br /&gt;
&lt;br /&gt;
  autoconf apache2-threaded-dev debian-builder&lt;br /&gt;
&lt;br /&gt;
Once you have them installed, open up a text console, go to the directory where you downloaded the mod_auth_ntlm_winbind files an execute the following commands (as a normal user):&lt;br /&gt;
&lt;br /&gt;
  autoconf&lt;br /&gt;
  ./configure --with-apxs=/usr/bin/apxs2 --with-apache=/usr/sbin/apache2&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
That should compile it without errors. Then as a user that can run commands as root via sudo, execute the following command from the same directory:&lt;br /&gt;
&lt;br /&gt;
  sudo make install&lt;br /&gt;
&lt;br /&gt;
This will create the final mod_auth_ntlm_winbind.so file and install it under /usr/lib/apache2/modules, with the rest of the Apache 2 modules (the size of the file and last modification time shown below may differ from your install):&lt;br /&gt;
&lt;br /&gt;
  ls -l /usr/lib/apache2/modules/mod_auth_ntlm_winbind.so&lt;br /&gt;
  -rw-r--r-- 1 root root 20921 2009-02-17 04:27 /usr/lib/apache2/modules/mod_auth_ntlm_winbind.so&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=42 Using Moodle: User authentication] forum&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=45887 NTLM Authentication] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=80104 Merging AD NTLM SSO into auth/ldap] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=186661 Moodle in a DMZ with NTLM] forum discussion&lt;br /&gt;
*[http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=314 Download the NTLM Authentication Module]&lt;br /&gt;
&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Authentification NTLM]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Guest_access&amp;diff=144316</id>
		<title>Guest access</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Guest_access&amp;diff=144316"/>
		<updated>2022-10-02T09:44:32Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Punctuation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
The Guest access facility allows users with the [[Guest_role |Guest role]] to view the contents of a course. This  might be used, for example, if a Moodle site serves as a website where certain courses contain publicly available information, or else with a commercial Moodle site where courses with guest access can  offers a &amp;quot;taster&amp;quot; of the kind of courses which may be purchased. (Note that the guest cannot participate in any activities; they can only view content.)&lt;br /&gt;
&lt;br /&gt;
==Course settings for guest access==&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/LSVLLu7GzHE | desc = How to allow guests into courses}}&lt;br /&gt;
# From Course navigation,  click &#039;Participants&#039;, and then from the dropdown, click &#039;Enrolment method&amp;gt; Guest access&#039;. With other themes, click &#039;&#039;Administration &amp;gt; Course administration &amp;gt; Users &amp;gt; Enrolment methods&#039;&#039; and then Guest access. &lt;br /&gt;
#Enable guest access by clicking on the &amp;quot;eye&amp;quot; icon or by choosing it in the &#039;Add method&#039; dropdown menu.&lt;br /&gt;
# If you wish to set a password, then click the configure icon and type in your password here.&lt;br /&gt;
&lt;br /&gt;
==Admin settings for guest access==&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/_xGrJ9-aqIc | desc = How to allow guests onto your Moodle site}}&lt;br /&gt;
&lt;br /&gt;
*In &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039;, ensure Guest access is enabled (has its eye open.) This enables Guest access.&lt;br /&gt;
* In &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; set the Guest login button to Show if you want the button on the Front page. &lt;br /&gt;
* Also Guest accounts can be logged - check the &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Logging &amp;gt; Log guest access&#039;&#039; setting.&lt;br /&gt;
* A site policy for guests may be set in &#039;&#039;Site administration &amp;gt; Security &amp;gt; Site policies&#039;&#039;. Guests then have to agree to the site policy before accessing a course with guest access.&lt;br /&gt;
&lt;br /&gt;
===Default settings for guest access===&lt;br /&gt;
*Clicking on &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Guest access&#039;&#039; brings up the screen where admin can set defaults for guest access in courses.&lt;br /&gt;
**Clicking the &#039;Advanced&#039; button next to &#039;Allow guest access&#039; will hide this setting in a course and will instead display a &#039;Show more&#039; link to click on to access the setting.&lt;br /&gt;
** Guest access can be turned on by default in all new courses and you can also:&lt;br /&gt;
**require each course with guest access to have a password for guests. (Note: this can confuse teachers who are not aware of the requirement.)&lt;br /&gt;
**use or ignore your Moodle&#039;s standard password policy for guest access passwords&lt;br /&gt;
**offer if needed the first letter of the password as a hint.&lt;br /&gt;
&lt;br /&gt;
===Auto-login guests===&lt;br /&gt;
*In &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; User policies&#039;&#039;, you can tick the box so that visitors are automatically logged in as guests when accessing a course with guest access (i.e. they don&#039;t have to click the &amp;quot;login as guest button&amp;quot;).&lt;br /&gt;
*In &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage Authentication&#039;&#039;, you must have &amp;quot;Guest login button&amp;quot; set to &amp;quot;Show&amp;quot;.&lt;br /&gt;
*In &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; Site policies&#039;&#039; you can check &amp;quot;Open to Google&amp;quot; setting so that the Google search robot will be allowed to enter your site as a Guest. In addition, people coming in to your site via a Google search will automatically be logged in as a Guest.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Guest role]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=347107#p1400235 Re: Guest access to course sections!] forum post&lt;br /&gt;
&lt;br /&gt;
[[de:Gastzugang zum Kurs]]&lt;br /&gt;
&lt;br /&gt;
[[es:Acceso de invitados]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=HTTP_security&amp;diff=143734</id>
		<title>HTTP security</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=HTTP_security&amp;diff=143734"/>
		<updated>2022-07-05T16:06:34Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Changed &amp;lt;code php&amp;gt; to indented &amp;lt;pre&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Security}}&lt;br /&gt;
*In Moodle 3.4 onwards, the setting &#039;Use HTTPS for logins&#039; (loginhttps) has been removed.&lt;br /&gt;
* There is a [[HTTPS conversion tool]] for converting embedded content to HTTPS.&lt;br /&gt;
&lt;br /&gt;
==Secure cookies only==&lt;br /&gt;
&lt;br /&gt;
It is recommended to use secure cookies only when serving over [https://en.wikipedia.org/wiki/Transport_Layer_Security SSL]. When not serving over SSL, the setting is ignored. In Moodle 3.1.2 onwards, the &#039;Secure cookies only&#039; default setting is on.&lt;br /&gt;
&lt;br /&gt;
==cURL blocked hosts list==&lt;br /&gt;
&lt;br /&gt;
This allows you to block Moodle&#039;s cURL implementation from accessing the specified hosts, wherever it is used to fetch content (such as by the URL downloader in the file picker). Generally it is recommended that as a minimum this is configured to prevent access to any internal network resources. The following is an example list of hosts which can be configured, which prevents access to various versions of &amp;quot;localhost&amp;quot;, as well as an address commonly used by AWS and some other cloud providers to provide meta data about the server instance (169.254.169.254):&lt;br /&gt;
&lt;br /&gt;
 127.0.0.1&lt;br /&gt;
 192.168.0.0/16&lt;br /&gt;
 10.0.0.0/8&lt;br /&gt;
 172.16.0.0/12&lt;br /&gt;
 0.0.0.0&lt;br /&gt;
 localhost&lt;br /&gt;
 169.254.169.254&lt;br /&gt;
 0000::1&lt;br /&gt;
&lt;br /&gt;
In future, some logical default values such as those above will be configured automatically for new Moodle sites. See MDL-56873 for more details.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; In addition to configuring this at the application level via this setting, it is also recommended that sufficient firewall/network security measures are in place, including restricting access to internal network endpoints to those users/services that require them.&lt;br /&gt;
&lt;br /&gt;
==cURL allowed ports list==&lt;br /&gt;
&lt;br /&gt;
This allows you to restrict Moodle&#039;s cURL implementation to only access the specified list of port numbers, wherever it is used to fetch content (such as by the URL downloader in the file picker). Generally it is recommended that this is configured to only allow standard web ports, as follows:&lt;br /&gt;
&lt;br /&gt;
 80&lt;br /&gt;
 443&lt;br /&gt;
&lt;br /&gt;
In future, some logical default values such as those above will be configured automatically for new Moodle sites. See MDL-56873 for more details.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; In addition to configuring this at the application level via this setting, it is also recommended that sufficient firewall/network security measures are in place, including restricting access to open ports on the internal network to those users/services that require them.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* MDL-55662 for removing the secure cookies only setting&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
&lt;br /&gt;
[[de:HTTP-Sicherheit]]&lt;br /&gt;
[[es:Seguridad HTTP]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=143628</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=143628"/>
		<updated>2022-06-10T17:50:21Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* User lookup settings */ Spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
Moodle supports several types of LDAP servers which have different directory structures, special configuration settings, etc. Even if using the same LDAP server type (e.g., MS Active Directory), each site could use a completely different directory structure to hold its user accounts, groups, etc. In order to be able to show example configuration settings in the sections below, we are going to assume a &#039;&#039;&#039;hypothetical&#039;&#039;&#039; Moodle site and LDAP server with the characteristics listed below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT NOTICE&#039;&#039;&#039;: be sure to check &#039;&#039;&#039;&#039;&#039;your&#039;&#039;&#039;&#039;&#039; Moodle site and LDAP server details (including its directory structure,) and adjust the settings to reflect your own setup.&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
===Enabling LDAP authentication===&lt;br /&gt;
&lt;br /&gt;
An administrator can enable LDAP authentication as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; and click the eye icon opposite LDAP Server. When enabled, it will no longer be greyed out.&lt;br /&gt;
# Click the settings link, configure as required (see information below), then click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novell Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (Yes) or not (No). This must be set to Yes for Active Directory.&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novell eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the LDAP sync users task. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Novell eDirectory and MS-AD can create users externally. You can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Assign system roles====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| System role mapping&lt;br /&gt;
| This section lists all roles that have can be assigned in the System context - by default this will be &amp;quot;Manager context&amp;quot; and &amp;quot;Course creator context&amp;quot;, but can be customisable in the [[Creating custom roles|role definitions]].&lt;br /&gt;
&lt;br /&gt;
To assign LDAP users to any of the roles, specify the DN containing all users who should be granted that role at the system level.&lt;br /&gt;
&lt;br /&gt;
Thie DN is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
&lt;br /&gt;
This section replaces the &amp;quot;Course creator&amp;quot; section found in Moodle 3.3. The upgrade process should migrate any DN specified to the new approach.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====User account synchronisation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usually &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usually &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usually &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usually &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Enabling the LDAP users sync job==&lt;br /&gt;
&lt;br /&gt;
The LDAP users sync job (&#039;&#039;\auth_ldap\task\sync_task&#039;&#039;) [[Scheduled tasks|scheduled task]] (new in Moodle 3.0; previously there was a CLI script, see MDL-51824 for more info)  is responsible for creating and updating user information, and suspending and deleting LDAP accounts. &lt;br /&gt;
&lt;br /&gt;
After enabling LDAP server authentication, an administrator needs to enable and configure the LDAP users sync job as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Server &amp;gt; Scheduled tasks&#039;&#039; and click the gear icon opposite LDAP users sync job.&lt;br /&gt;
# Select the desired frequency of running and enable the task by un-ticking the disabled checkbox.&lt;br /&gt;
{{Warning|It is important to make sure that all LDAP settings are working properly before enabling the LDAP users sync job (as well as backing up your database and moodledata folders), since incorrect LDAP configuration can result in users being wrongly deleted!}}&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher than Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions in http://support.microsoft.com/kb/315071 to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain] forum discussion&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more than one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning always the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Any questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?id=42 Authentication forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=143627</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=143627"/>
		<updated>2022-06-10T17:47:45Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* User lookup settings */ Spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
Moodle supports several types of LDAP servers which have different directory structures, special configuration settings, etc. Even if using the same LDAP server type (e.g., MS Active Directory), each site could use a completely different directory structure to hold its user accounts, groups, etc. In order to be able to show example configuration settings in the sections below, we are going to assume a &#039;&#039;&#039;hypothetical&#039;&#039;&#039; Moodle site and LDAP server with the characteristics listed below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT NOTICE&#039;&#039;&#039;: be sure to check &#039;&#039;&#039;&#039;&#039;your&#039;&#039;&#039;&#039;&#039; Moodle site and LDAP server details (including its directory structure,) and adjust the settings to reflect your own setup.&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
===Enabling LDAP authentication===&lt;br /&gt;
&lt;br /&gt;
An administrator can enable LDAP authentication as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; and click the eye icon opposite LDAP Server. When enabled, it will no longer be greyed out.&lt;br /&gt;
# Click the settings link, configure as required (see information below), then click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novell Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (Yes) or not (No). This must be set to Yes for Active Directory.&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the LDAP sync users task. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Novell eDirectory and MS-AD can create users externally. You can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Assign system roles====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| System role mapping&lt;br /&gt;
| This section lists all roles that have can be assigned in the System context - by default this will be &amp;quot;Manager context&amp;quot; and &amp;quot;Course creator context&amp;quot;, but can be customisable in the [[Creating custom roles|role definitions]].&lt;br /&gt;
&lt;br /&gt;
To assign LDAP users to any of the roles, specify the DN containing all users who should be granted that role at the system level.&lt;br /&gt;
&lt;br /&gt;
Thie DN is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
&lt;br /&gt;
This section replaces the &amp;quot;Course creator&amp;quot; section found in Moodle 3.3. The upgrade process should migrate any DN specified to the new approach.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====User account synchronisation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usually &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usually &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usually &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usually &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Enabling the LDAP users sync job==&lt;br /&gt;
&lt;br /&gt;
The LDAP users sync job (&#039;&#039;\auth_ldap\task\sync_task&#039;&#039;) [[Scheduled tasks|scheduled task]] (new in Moodle 3.0; previously there was a CLI script, see MDL-51824 for more info)  is responsible for creating and updating user information, and suspending and deleting LDAP accounts. &lt;br /&gt;
&lt;br /&gt;
After enabling LDAP server authentication, an administrator needs to enable and configure the LDAP users sync job as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Server &amp;gt; Scheduled tasks&#039;&#039; and click the gear icon opposite LDAP users sync job.&lt;br /&gt;
# Select the desired frequency of running and enable the task by un-ticking the disabled checkbox.&lt;br /&gt;
{{Warning|It is important to make sure that all LDAP settings are working properly before enabling the LDAP users sync job (as well as backing up your database and moodledata folders), since incorrect LDAP configuration can result in users being wrongly deleted!}}&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher than Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions in http://support.microsoft.com/kb/315071 to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain] forum discussion&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more than one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning always the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Any questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?id=42 Authentication forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Activity_completion_FAQ&amp;diff=143417</id>
		<title>Activity completion FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Activity_completion_FAQ&amp;diff=143417"/>
		<updated>2022-05-18T08:59:50Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Can I move the activity completion checkboxes to the left instead of the right? */ Changed &amp;lt;code&amp;gt; to &amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Activity completion}}&lt;br /&gt;
==What happens when completion conditions are unlocked?==&lt;br /&gt;
&lt;br /&gt;
Once you unlock options and then click &#039;Save changes&#039;, all completion information for the activity will be deleted and, if possible, regenerated according to the new settings. See the section &#039;What happens when you unlock&#039; in [[Activity completion settings]] for further details.&lt;br /&gt;
==Can I change the default completion settings for activities in my course?==&lt;br /&gt;
Yes. See [[Activity completion settings]] for how to do this.&lt;br /&gt;
&lt;br /&gt;
==Activity completion status does not change==&lt;br /&gt;
Check &#039;&#039;Site administration &amp;gt; Server &amp;gt; Scheduled tasks&#039;&#039; and the task Calculate completion data. This should ideally be once a minute.&lt;br /&gt;
&lt;br /&gt;
==Can I move the activity completion checkboxes to the left instead of the right?==&lt;br /&gt;
[[File:checkboxleft.png]]&lt;br /&gt;
&lt;br /&gt;
Please see MDL-34729 and MDL-31603&lt;br /&gt;
&lt;br /&gt;
This is a not-fully tested solution, based on adapting Christian Herman&#039;s tip from Moodle 2.0 to 2.5 and discussion in https://moodle.org/mod/forum/discuss.php?d=263661&lt;br /&gt;
If you are using Clean or More theme, add the following to the Custom CSS box in &#039;&#039;Appearance&amp;gt;Themes&amp;gt;Clean&#039; (or More)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Completion Checkbox Left of Activity Icon and Align Checkboxes Full Left */&lt;br /&gt;
.section .activity .actions {    position: relative; }&lt;br /&gt;
&lt;br /&gt;
.path-course-view li.activity span.autocompletion, .path-course-view li.activity form.togglecompletion&lt;br /&gt;
{    float: left;    margin-left: -15px;}&lt;br /&gt;
&lt;br /&gt;
/* Small Space Between Checkbox &amp;amp; Icon */&lt;br /&gt;
.path-course-view .section .activity img.activityicon&lt;br /&gt;
{ padding-left: 1em; }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Aktivitätsabschluss FAQ]]&lt;br /&gt;
[[es:Finalización de actividad FAQ]]&lt;br /&gt;
[[fr:FAQ sur l&#039;achèvement des activités]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Talk:Activity_completion_report&amp;diff=142868</id>
		<title>Talk:Activity completion report</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Talk:Activity_completion_report&amp;diff=142868"/>
		<updated>2022-01-22T17:51:36Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Added note about the previous key for activity completion status icons&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I was looking for a key for the icons in the Activity Completion Report and couldn&#039;t find one. So here&#039;s a draft based on my understanding of this. [[User:Leon Stringer|Leon Stringer]] ([[User talk:Leon Stringer|talk]]) 12:11, 10 June 2021 (UTC)&lt;br /&gt;
{|&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align:left&amp;quot;|Automatic versus manual completion&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-n.svg|16x16px|Dashed line box]]&lt;br /&gt;
|Box with dashed line&lt;br /&gt;
|Activity is completed automatically. For example: a quiz with &#039;&#039;Completion tracking&#039;&#039; set to &amp;quot;Show activity as complete when conditions are met&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-manual-n.svg|16x16px|Solid line box]]&lt;br /&gt;
|Box with solid line&lt;br /&gt;
|Activity is completed manually by learner. For example: a file with &#039;&#039;Completion tracking&#039;&#039; set to &amp;quot;Students can manually mark the activity as completed&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align:left&amp;quot;|Completion status&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-n.svg|16x16px|Dashed line box]] [[File:completion-manual-n.svg|16x16px|Solid line box]]&lt;br /&gt;
|Empty box&lt;br /&gt;
|Activity not complete.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-y.svg|16x16px|Dashed line box, blue tick]] [[File:completion-manual-y.svg|16x16px|Solid line box, blue tick]]&lt;br /&gt;
|Blue tick&lt;br /&gt;
|Activity completed and no passing grade applies. For example: passing grade does not apply to this activity type, or passing grade has not been set as part of the activity&#039;s completion criteria.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-pass.svg|16x16px|Dashed line box, green tick]]&lt;br /&gt;
|Green tick&lt;br /&gt;
|Completed, activity has passing grade which was achieved.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-fail.svg|16x16px|Dashed line box, red cross]]&lt;br /&gt;
|Red cross&lt;br /&gt;
|Activity not completed and completion not possible. For example: all quiz attempts have been used without achieving the passing grade.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align:left&amp;quot;|Override completion status&lt;br /&gt;
|-&lt;br /&gt;
|[[File:completion-auto-y-override.svg|16x16px|Dashed red line box, blue tick]] [[File:completion-manual-y-override.svg|16x16px|Solid red line box, blue tick]] [[File:completion-manual-n-override.svg|16x16px|Solid red line box, empty]]&lt;br /&gt;
|Box with red border&lt;br /&gt;
|Completion status has been manually set by teacher, manager or site administrator.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For anybody interested (and as a memo to myself) the above list of icons was [https://docs.moodle.org/402/en/index.php?title=Using_Activity_completion&amp;amp;oldid=139704#Activity_completion_icons previously in Using Activity completion] but was removed. [[User:Leon Stringer|Leon Stringer]] ([[User talk:Leon Stringer|talk]]) 17:50, 22 January 2022 (UTC)&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Performance_settings&amp;diff=142867</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Performance_settings&amp;diff=142867"/>
		<updated>2022-01-21T10:09:20Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* config.php settings which may affect performance */ Change &amp;lt;code&amp;gt; to &amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The setting &amp;quot;Maximum time limit&amp;quot;  lets you restrict  the maximum PHP execution time that Moodle will allow without any output being displayed. If you have a front-end server with its own time limit, set this value lower to receive PHP errors in logs.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Check your filters. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. Check if any of the filters can be disabled. For example, if your site does not need to be able to display mathematical equations you can disable the [[MathJax filter]].&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE &#039;&#039;&#039;may&#039;&#039;&#039; reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
// a Moodle having 1250 course categories.&lt;br /&gt;
// This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=225617 setting innodb buffer pool from 100mb to 3gb] resulted in outstanding performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;br /&gt;
[[es:Configuraciones para desempeño]]&lt;br /&gt;
[[fr:Réglages de performance]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Apache&amp;diff=142832</id>
		<title>Apache</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Apache&amp;diff=142832"/>
		<updated>2022-01-18T18:09:43Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Hiding internal paths */ Removed &amp;#039;#&amp;#039; comment prefixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
&#039;&#039;&#039;This article refers to the &#039;Apache HTTP server&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Apache HTTP server is the software that (along with the PHP scripting language) &#039;runs&#039; Moodle. Note that there are alternatives (e.g. IIS on Windows, Nginx on Linux, MacOS) but the Apache HTTP Server is very popular on all platforms. &lt;br /&gt;
&lt;br /&gt;
== Installing Apache ==&lt;br /&gt;
Installers are available for most platforms from http://httpd.apache.org/download.cgi. The official installation instructions are here: http://httpd.apache.org/docs/2.0/install.html. If you are running Linux then you are recommended to use the packaged version if you can. For example, in Debian/Ubuntu it is simply:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install apache2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the documentation for your particular platform for the instructions. Apache is straightforward to build from source if you have to and the PHP documentation contains an article on building both Apache and PHP together - although you should rarely need to do that.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
See [[Performance recommendations]]&lt;br /&gt;
&lt;br /&gt;
==Slasharguments==&lt;br /&gt;
&lt;br /&gt;
The function &#039;&#039;slash arguments&#039;&#039; is required for various features in Moodle to work correctly, as described in [[Using slash arguments]].&lt;br /&gt;
&lt;br /&gt;
To turn it on, add this line to your &#039;&#039;httpd.conf&#039;&#039;, or to a &#039;&#039;.htaccess&#039;&#039; file in your local directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;apacheconf&amp;quot;&amp;gt;&lt;br /&gt;
AcceptPathInfo On&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; When using &amp;quot;.htaccess&amp;quot; in your local Moodle install folder, you may need to include/enable &amp;quot;AllowOverride Directive&amp;quot; in &amp;quot;httpd.conf&amp;quot;, first.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; Using .htaccess file will cause performance hit on your server!&lt;br /&gt;
&lt;br /&gt;
If you are using Ionos (formerly 1&amp;amp;1) shared webhosting, the above does not work, there is a known bug when using PHP as CGI.  The solution is to create a php.ini file in the moodle directory with this content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
cgi.fix_pathinfo = 0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also Ionos requires that this php.ini be in every directory that a script executes.  Use the procedure below to link a php.ini in every subdirectory back to your original php.ini file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd your_moodle_directory&lt;br /&gt;
find -type d -exec ln -s $PWD/php.ini {}/php.ini \;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source: [https://www.ionos.com/help/hosting/using-php-for-web-projects/applying-php-settings-to-all-subdirectories/ Ionos php.ini Help] &lt;br /&gt;
&lt;br /&gt;
This may affect other shared hosting providers as well.&lt;br /&gt;
&lt;br /&gt;
== Handling 40x errors  ==&lt;br /&gt;
&lt;br /&gt;
This enables missing files to be themed by Moodle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ErrorDocument 404 /error/index.php&lt;br /&gt;
 &lt;br /&gt;
# This sends any 403 from apache through to the same page, but also&lt;br /&gt;
# overrides the http status with 404 instead for better security.&lt;br /&gt;
ErrorDocument 403 /error/index.php?code=404&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Hiding internal paths ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
RewriteEngine On&lt;br /&gt;
 &lt;br /&gt;
RewriteRule &amp;quot;(\/vendor\/)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/node_modules\/)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(^|/)\.(?!well-known\/)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(composer\.json)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\.lock)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/environment.xml)&amp;quot; - [F]&lt;br /&gt;
Options -Indexes&lt;br /&gt;
RewriteRule &amp;quot;(\/install.xml)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/README)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/readme)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/moodle_readme)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/upgrade\.txt)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(phpunit\.xml\.dist)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/tests\/behat\/)&amp;quot; - [F]&lt;br /&gt;
RewriteRule &amp;quot;(\/fixtures\/)&amp;quot; - [F]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SSL==&lt;br /&gt;
&lt;br /&gt;
Moodle has an option to enable HTTPS for the whole site or for just the login pages; either option requires that your web server is configured for SSL.&lt;br /&gt;
&lt;br /&gt;
* Whole site HTTPS is enabled by changing http://&amp;lt;url&amp;gt; to https:// &amp;lt;url&amp;gt; in your config.php &#039;wwwroot&#039; parameter.&lt;br /&gt;
* Login only HTTPS is enabled by setting the &#039;loginhttps&#039; parameter, where the wwwroot schema should remain as http://&lt;br /&gt;
&lt;br /&gt;
NOTE: Login only https was deprecated and removed from Moodle 3.4: https://tracker.moodle.org/browse/MDL-42834&lt;br /&gt;
&lt;br /&gt;
Login only https is available in Moodle 3.3 and earlier in the admin interface via Administration&amp;gt;Security&amp;gt;HTTP Security and checking the button. (Note the warning and see ssl section below)&lt;br /&gt;
&lt;br /&gt;
Prior to Moodle 2.3 It was not advised to run the whole site over HTTPS due to legacy restrictions with client-side caching. This is no longer the case assuming client browsers support the &#039;Cache-Control: public&#039; method, which all supported browsers for this version of Moodle do.&lt;br /&gt;
&lt;br /&gt;
To use HTTPS you will need to obtain an SSL certificate, you have two options:&lt;br /&gt;
&lt;br /&gt;
* Generate a self-signed certificate. This is fine on (say) an Intranet but unsuitable for the public internet, but users will we warned the certificated is untrusted when used publicly.&lt;br /&gt;
* Purchase a certificate from a vendor. There is a surprising range of prices and value-added services available. Some hosting companies even provide free certificates. &lt;br /&gt;
&lt;br /&gt;
Debian provides instructions for installing a self-signed certificate [https://wiki.debian.org/Self-Signed_Certificate on their wiki] and includes general information on configuring Apache for SSL.&lt;br /&gt;
If you purchase a vendor certificate you will normally receive instructions for installing it.&lt;br /&gt;
&lt;br /&gt;
A basic Apache SSL configuration can be summarised as:&lt;br /&gt;
&lt;br /&gt;
 Listen 443&lt;br /&gt;
 NameVirtualHost *:443&lt;br /&gt;
 &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
     SSLEngine On&lt;br /&gt;
     SSLCertificateFile /path/to/your/certificate.crt&lt;br /&gt;
     SSLCertificateKeyFile /path/to/your/certificate.key&lt;br /&gt;
     ...&lt;br /&gt;
 &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Load Balancer Hints (AWS) ==&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using an AWS load balancer in front your infrastructure, you can set up some of the configuration above, preventing traffic to go forward. Here is the configuration applied to hide files, with a few considerations due to known limitations:&lt;br /&gt;
* 100 total rules per application load balancer&lt;br /&gt;
* 5 condition values per rule&lt;br /&gt;
* 5 wildcards per rule&lt;br /&gt;
* 5 weighted target groups per rule:&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;Conditions&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;Field&amp;quot;: &amp;quot;path-pattern&amp;quot;, &lt;br /&gt;
                &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                    &amp;quot;*/.*&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/upgrade.txt&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/db/install.xml&amp;quot;,&lt;br /&gt;
                    &amp;quot;*/README.md&amp;quot;&lt;br /&gt;
                ], &lt;br /&gt;
                &amp;quot;PathPatternConfig&amp;quot;: {&lt;br /&gt;
                    &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                        &amp;quot;*/.*&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/upgrade.txt&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/db/install.xml&amp;quot;,&lt;br /&gt;
                        &amp;quot;*/README.md&amp;quot;&lt;br /&gt;
                    ]&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        ], &lt;br /&gt;
        &amp;quot;Actions&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;Type&amp;quot;: &amp;quot;fixed-response&amp;quot;, &lt;br /&gt;
                &amp;quot;Order&amp;quot;: 1, &lt;br /&gt;
                &amp;quot;FixedResponseConfig&amp;quot;: {&lt;br /&gt;
                    &amp;quot;ContentType&amp;quot;: &amp;quot;text/html&amp;quot;, &lt;br /&gt;
                    &amp;quot;MessageBody&amp;quot;: &amp;quot;&amp;lt;html&amp;gt;\n&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;404 Not Found&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;\n&amp;lt;body&amp;gt;\n&amp;lt;center&amp;gt;&amp;lt;h1&amp;gt;404 Not Found&amp;lt;/h1&amp;gt;&amp;lt;/center&amp;gt;\n&amp;lt;hr&amp;gt;\n&amp;lt;/body&amp;gt;\n&amp;lt;/html&amp;gt;&amp;quot;, &lt;br /&gt;
                    &amp;quot;StatusCode&amp;quot;: &amp;quot;404&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    }, &lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;Conditions&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;Field&amp;quot;: &amp;quot;path-pattern&amp;quot;, &lt;br /&gt;
                &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                    &amp;quot;*/composer.json&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/Gruntfile.js&amp;quot;,&lt;br /&gt;
                    &amp;quot;*.lock&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/environtment.xml&amp;quot;,&lt;br /&gt;
                    &amp;quot;*/readme.txt&amp;quot;&lt;br /&gt;
                ], &lt;br /&gt;
                &amp;quot;PathPatternConfig&amp;quot;: {&lt;br /&gt;
                    &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                        &amp;quot;*/composer.json&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/Gruntfile.js&amp;quot;,&lt;br /&gt;
                        &amp;quot;*.lock&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/environtment.xml&amp;quot;,&lt;br /&gt;
                        &amp;quot;*/readme.txt&amp;quot;&lt;br /&gt;
                    ]&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        ], &lt;br /&gt;
        &amp;quot;Actions&amp;quot;: [ #### Same as above&lt;br /&gt;
            ...&lt;br /&gt;
        ]&lt;br /&gt;
    }, &lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;Conditions&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;Field&amp;quot;: &amp;quot;path-pattern&amp;quot;, &lt;br /&gt;
                &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                    &amp;quot;*/fixtures/*&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/behat/*&amp;quot;, &lt;br /&gt;
                    &amp;quot;*/phpunit.xml&amp;quot;&lt;br /&gt;
                ], &lt;br /&gt;
                &amp;quot;PathPatternConfig&amp;quot;: {&lt;br /&gt;
                    &amp;quot;Values&amp;quot;: [&lt;br /&gt;
                        &amp;quot;*/fixtures/*&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/behat/*&amp;quot;, &lt;br /&gt;
                        &amp;quot;*/phpunit.xml&amp;quot;&lt;br /&gt;
                    ]&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        ], &lt;br /&gt;
        &amp;quot;Actions&amp;quot;: [ #### Same as above&lt;br /&gt;
            ...&lt;br /&gt;
        ]&lt;br /&gt;
    }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://httpd.apache.org/ The Apache HTTP Server Project homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_HTTP_Server Wikipedia article on the Apache HTTP Server]&lt;br /&gt;
* [http://httpd.apache.org/docs/2.0/misc/perf-tuning.html Apache Performance Tuning article at the official homepage]&lt;br /&gt;
* [https://els.earlham.edu/cayaraa/weblog/1468.html Making Moodle work with SSL]&lt;br /&gt;
* [http://www.krufix.de/ Using the same Moodle twice in local network and Internet via SSL-Proxy] (in German)&lt;br /&gt;
&lt;br /&gt;
[[pl:Apache]]&lt;br /&gt;
[[ja:Apache]]&lt;br /&gt;
[[de:Apache]]&lt;br /&gt;
[[es:Apache]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=File:phpMyAdmin3.png&amp;diff=142760</id>
		<title>File:phpMyAdmin3.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=File:phpMyAdmin3.png&amp;diff=142760"/>
		<updated>2021-12-24T10:53:32Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Screenshot from phpMyAdmin of the output from SHOW GLOBAL VARIABLES ... on MySQL 8.0.21.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Screenshot from phpMyAdmin of the output from SHOW GLOBAL VARIABLES ... on MySQL 8.0.21.&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=MySQL&amp;diff=142759</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=MySQL&amp;diff=142759"/>
		<updated>2021-12-24T10:51:51Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Configure full UTF-8 support */ Improve wording based on https://moodle.org/mod/forum/discuss.php?d=430261&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
MySQL is one of the supported databases that underpins a Moodle installation. &lt;br /&gt;
&lt;br /&gt;
== Installing MySQL ==&lt;br /&gt;
&lt;br /&gt;
* If you are running Linux your preference should be to install using your distribution&#039;s package manager. This ensures you will get any available updates.  However, you can also use apt-get or yum depending on the distribution that you are running.&lt;br /&gt;
* There are installers available for most popular operating systems at http://www.mysql.com/downloads/mysql/.&lt;br /&gt;
* It is possible and reasonably straightforward to build mysql from source but it is not recommended (the pre-built binaries are supposedly better optimised).&lt;br /&gt;
* Make sure you set a password for the &#039;root&#039; user (see http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html).&lt;br /&gt;
* Consider installing and configuring my.cnf (the MySQL settings file) to suit your needs. The default configuration is usually very conservative in respect of memory usage versus performance. Increase the &#039;max_allowed_packet&#039; setting to at least 4 megabytes.&lt;br /&gt;
* If you are going to use Master/Slave replication, you must add binlog_format = &#039;ROW&#039; into your my.cnf within [mysqld]. Otherwise, Moodle will not be able to write to the database.&lt;br /&gt;
&lt;br /&gt;
=== Configure full UTF-8 support ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s recommended that full UTF-8 support is configured in MySQL. If this is not done some character sets – notably emojis – cannot be used. It is possible to do this after installing your site but is much easier and quicker before installation.&lt;br /&gt;
&lt;br /&gt;
Check if this is already configured by running the following statement, e.g. at the &#039;&#039;&#039;mysql&amp;gt;&#039;&#039;&#039; prompt or in phpMyAdmin:&lt;br /&gt;
&amp;lt;pre&amp;gt;SHOW GLOBAL VARIABLES WHERE variable_name IN (&#039;innodb_file_format&#039;, &#039;innodb_large_prefix&#039;, &#039;innodb_file_per_table&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:phpMyAdmin1.png|alt=innodb_file_format=Barracuda;innodb_file_per_table=ON;innodb_large_prefix=ON]] or [[File:phpMyAdmin2.png|alt=innodb_file_format=(blank);innodb_file_per_table=ON;innodb_large_prefix=(blank)]] or [[File:phpMyAdmin3.png|alt=innodb_file_per_table=ON]]&lt;br /&gt;
&lt;br /&gt;
If the settings you see match any list above then no changes are needed and you can skip to [[#Creating_Moodle_database| Creating Moodle database]].&lt;br /&gt;
&lt;br /&gt;
If your settings do not match any list you will have to edit the MySQL configuration file. On Linux this may be &#039;&#039;&#039;/etc/my.cnf&#039;&#039;&#039;, &#039;&#039;&#039;/etc/mysql/my.cnf&#039;&#039;&#039;, or &#039;&#039;&#039;/etc/my.cnf.d/mariadb-server.cnf&#039;&#039;&#039;; on Microsoft Windows it may be &#039;&#039;&#039;my.ini&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Note: Back up the configuration file before changing it.&lt;br /&gt;
* Note: Back up all databases before making this change.&lt;br /&gt;
* Note: Other systems with databases on this server may be impacted by this change.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the following settings to the configuration file, do not add &#039;&#039;&#039;innodb_file_format = Barracuda&#039;&#039;&#039; and &#039;&#039;&#039;innodb_large_prefix = 1&#039;&#039;&#039; if these were blank or missing when you ran &#039;&#039;&#039;SHOW GLOBAL VARIABLES&#039;&#039;&#039; above:&lt;br /&gt;
&amp;lt;pre&amp;gt;[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
innodb_file_format = Barracuda   # Remove line if not needed&lt;br /&gt;
innodb_file_per_table = 1&lt;br /&gt;
innodb_large_prefix = 1          # Remove line if not needed&lt;br /&gt;
&lt;br /&gt;
character-set-server = utf8mb4&lt;br /&gt;
collation-server = utf8mb4_unicode_ci&lt;br /&gt;
skip-character-set-client-handshake&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the MySQL server process to apply these settings (for example with MariaDB on Linux: &#039;&#039;&#039;systemctl restart mariadb&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
If you have any difficulty applying these settings, see [[MySQL_full_unicode_support]] for further information.&lt;br /&gt;
&lt;br /&gt;
If for some reason you cannot change to the settings described here you can continue to install Moodle but you must select &#039;&#039;&#039;utf8&#039;&#039;&#039; and &#039;&#039;&#039;utf8_unicode_ci&#039;&#039;&#039; for the default character set and collation respectively.&lt;br /&gt;
&lt;br /&gt;
== Creating Moodle database ==&lt;br /&gt;
&lt;br /&gt;
These are the steps to create an empty Moodle database. Substitute your own database name, user name and password as appropriate.&lt;br /&gt;
&lt;br /&gt;
The instructions assume that the web server and MySQL server are on the same machine. In this case the &#039;dbhost&#039; is &#039;localhost&#039;. If they are on different machines substitute the name of the web server for &#039;localhost&#039; in the following instructions and the &#039;dbhost&#039; setting will be the name of the database server. &lt;br /&gt;
Databases have a &amp;quot;Character set&amp;quot; and a &amp;quot;Collation&amp;quot;. For Moodle, we recommend the Character Set be set to &#039;&#039;&#039;utf8mb4&#039;&#039;&#039; and the Collation &#039;&#039;&#039;utf8mb4_unicode_ci&#039;&#039;&#039;. You may get the option to set these values when you create the database. If you are not given a choice, the default options are probably good. An install on an old server may have the wrong settings.&lt;br /&gt;
&lt;br /&gt;
=== Command line === &lt;br /&gt;
&lt;br /&gt;
* To create a database using the &#039;mysql&#039; command line client, first log into MySQL&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mysql -u root -p&lt;br /&gt;
Enter password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Enter the password you previously set - or been given - for the MySQL &#039;root&#039; user). After some pre-amble this should take you to the &#039;&#039;mysql&amp;gt;&#039;&#039; prompt.&lt;br /&gt;
* Create a new database (called &#039;moodle&#039; - substitute your own name if required).&lt;br /&gt;
If you have successfully configured the recommended full UTF-8 support as described above run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you do not have the recommended full UTF-8 support run:&lt;br /&gt;
&amp;lt;pre&amp;gt;mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Add a user/password with the minimum needed permissions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE USER moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&lt;br /&gt;
mysql&amp;gt; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost;&lt;br /&gt;
mysql&amp;gt; FLUSH PRIVILEGES;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which creates a user called &#039;moodleuser&#039; with a password &#039;yourpassword&#039;. Make sure you invent a strong password and resist the temptation to &#039;GRANT ALL&#039;.&lt;br /&gt;
* Exit from mysql:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; quit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== phpMyAdmin ===&lt;br /&gt;
&lt;br /&gt;
[http://www.phpmyadmin.net/ phpMyAdmin] is a web based administration tool for MySQL. If this is available you can use it to create a new database. If you have successfully configured the recommended full UTF-8 support as described above select collation &#039;&#039;&#039;utf8mb4_unicode_ci&#039;&#039;&#039;. If you do not have the recommended full UTF-8 support select collation &#039;&#039;&#039;utf8_unicode_ci&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Which database belongs to which Moodle==&lt;br /&gt;
If you have installed several Moodle installations on the same server, there will be several databases in your MySQL server. The names might be quite poor reflections of the content like  _mdl1 _mdl2 _mdl3 . So how do I see which database goes with which Moodle installation? You can go in with phpMyAdmin and in the various databases check for the table &amp;quot;mdl_course&amp;quot;. There you will easily see the name of that Moodle Installation. In table mdl_config you can see the Moodle version. The main URL for the site is not in the database except where there are absolute links.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]]&lt;br /&gt;
* [[MySQL full unicode support]]&lt;br /&gt;
* [http://www.mysql.com/ The MySQL homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/MySQL Wikipedia article about &#039;&#039;MySQL&#039;&#039;]&lt;br /&gt;
* [http://forums.mysql.com/read.php?24,92131,92131 List of articles on MySQL performance tuning]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL databases]]&lt;br /&gt;
&lt;br /&gt;
[[ja:MySQL]]&lt;br /&gt;
[[de:MySQL]]&lt;br /&gt;
[[es:MySQL]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Upload_users&amp;diff=142755</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Upload_users&amp;diff=142755"/>
		<updated>2021-12-16T12:11:14Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Grammar/missing words&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Accounts}}&lt;br /&gt;
==Uploading users via text file==&lt;br /&gt;
&lt;br /&gt;
There are many options for uploading information (fields associated with a user) with this method: from enrolling users in multiple courses with course specific [[roles]] to updating user information in the [[User profile]] to deleting users from the site.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; It is usually not necessary to upload users in bulk with Upload users. To keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the users create their own accounts ([[Self enrolment]]). See [[Authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/blUw-ZbhFqw| desc = How to bulk upload users and add to courses}}&lt;br /&gt;
&lt;br /&gt;
==File formats for upload users file==&lt;br /&gt;
The upload users file has fields separated by a comma (or other delimiter) ONLY - no space.   The first line contains the valid field names.  The rest of the lines (records) contain information about each user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; Avoid special characters in field information like quotes or other commas. Test a file with only one record before a large upload.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; You can use a spread sheet program to create the file with the required columns and fields. Then save the file as &amp;quot;CSV (comma delimited)&amp;quot;. These files can be opened with simple text editors (e.g., [https://notepad-plus-plus.org/ Notepad++]) for verification. &lt;br /&gt;
&lt;br /&gt;
===Valid upload file for testing===&lt;br /&gt;
&lt;br /&gt;
*From Site administration / Users / Upload users, an example text (.csv) file is available. It includes can be downloaded and adapted to your needs. &lt;br /&gt;
&lt;br /&gt;
username,firstname,lastname,email&lt;br /&gt;
&lt;br /&gt;
student1,Student,One,s1@example.com&lt;br /&gt;
&lt;br /&gt;
student2,Student,Two,s2@example.com&lt;br /&gt;
&lt;br /&gt;
student3,Student,Three,s3@example.com&lt;br /&gt;
&lt;br /&gt;
*Additional fields can be added as below. The course and cohort must already have been manually created.&lt;br /&gt;
&lt;br /&gt;
username,firstname,lastname,email,course1,group1,cohort1&lt;br /&gt;
&lt;br /&gt;
student1,Student,One,s1@example.com,math102,groupA,cohortZ&lt;br /&gt;
&lt;br /&gt;
student2,Student,Two,s2@example.com,math102,groupB,cohort Y&lt;br /&gt;
&lt;br /&gt;
student3,Student,Three,s3@example.com,math102,groupA,cohortZ&lt;br /&gt;
&lt;br /&gt;
== User Fields that can be included==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; We strongly recommend that you test a file that contains fields you proposed to use with one user before attempting a file upload for the first time. &lt;br /&gt;
&lt;br /&gt;
===Required fields===&lt;br /&gt;
&lt;br /&gt;
These are the required user identification fields:&lt;br /&gt;
&amp;lt;code&amp;gt;username,firstname,lastname,email&amp;lt;/code&amp;gt;&lt;br /&gt;
Validity checks are performed for:&lt;br /&gt;
* &#039;&#039;&#039;username&#039;&#039;&#039; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters, numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
* &#039;&#039;&#039;email&#039;&#039;&#039; is in the form: &#039;&#039;name@example.com&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Passwords===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;password&amp;quot; field is optional if the &#039;New user password&#039; setting on the upload screen is set to &amp;quot;Create password if needed and send via email&amp;quot;  but is required if the setting is &amp;quot;Field required in file&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If included, values should meet the requirements for the site&#039;s [[Site policies#Password policy|Password policy]]. &lt;br /&gt;
&lt;br /&gt;
To force password change for a particular user, set the password field to &#039;&#039;&#039;changeme&#039;&#039;&#039;. If omitted, a password will be generated for each user (during the next Cron job) and welcome e-mails sent out. The text for the welcome e-mail is in the language settings in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language customisation&#039;&#039;  with a String identifier of &#039;newusernewpasswordtext&#039;.&lt;br /&gt;
&lt;br /&gt;
===Optional user fields===&lt;br /&gt;
&lt;br /&gt;
Note: Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
Tip: For Boolean fields with only two values, use &#039;&#039;&#039;0&#039;&#039;&#039; for false and &#039;&#039;&#039;1&#039;&#039;&#039;for true. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To provide values other than the default you can include one or more of these optional user fields:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;institution,department,city,country,lang,auth,timezone,idnumber,icq,phone1,phone2,address,url,description,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,interests,theme&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the these are user profile fields or user preference fields that belong to the user profile and are the filled in the user or at manual creation. Some however require specific formats:&lt;br /&gt;
&lt;br /&gt;
See [[Additional name fields]] for more details. Key things to note are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;country&#039;&#039;&#039; - use the country TWO LETTER CODE, in upper case, e.g. AU,ES,GB,US. These are all UPPER CASE. Using &amp;quot;au&amp;quot; or &amp;quot;es&amp;quot; or &amp;quot;USA&amp;quot; as a country code will result in a database error. If you are having trouble working out the two-letter code for a country, you can consult the list of [https://www.iso.org/obp/ui/#search country names and code elements] available on the ISO Website. A common error is to use UK for United Kingdom; it should be GB.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;lang&#039;&#039;&#039; - use the two letter (or extended four lettter) code as defined in the Moodle language packs, e.g. en, es, en_us, de, in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language packs&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth&#039;&#039;&#039; - The auth field must be used if the site uses an alternative authentication method, such as LDAP, as otherwise the authentication method will default to manual and users using a different auth method won&#039;t be able to log in. &lt;br /&gt;
Use the shortname codes defined in Plugins &amp;gt; Authentication for the various types, e.g. manual, nlogin, ldap, cas, mnet, db, none. If you do not include an auth column, then newly created users will be created with the manual account type.&lt;br /&gt;
&lt;br /&gt;
You can set &amp;quot;auth&amp;quot; to &amp;quot;nologin&amp;quot; in your csv file which will mean that then created users cannot login.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;timezone&#039;&#039;&#039; - Should be in the format as found in the Location settings in terms of Zone/Region, e.g. Australia/Sydney, Asia/Kathmandu, Europe/Madrid, etc. The entry is case sensitive so Europe/London will work but europe/london will not.&lt;br /&gt;
&lt;br /&gt;
NOTE: Needed: settings for &#039;&#039;&#039;mailformat&#039;&#039;&#039;,&#039;&#039;&#039;maildisplay&#039;&#039;&#039;,&#039;&#039;&#039;htmleditor&#039;&#039;&#039;,&#039;&#039;&#039;autosubscribe&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;maildigest&#039;&#039;&#039; To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;maildisplay&#039;&#039;&#039; allows you to set the email display option for a user. The options for this field are 0 = Hide my email address from non-privileged users, 1 = Allow everyone to see my email address and 2 = Allow only other course members to see my email address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;theme&#039;&#039;&#039; User themes may be added by using &#039;classic&#039;, &#039;boost&#039; or the name of any other installed theme. The value should be the short name of the theme, e.g. &#039;boost&#039; not &#039;Boost&#039;, &#039;fordson&#039; not &#039;Fordson&#039;.&lt;br /&gt;
&lt;br /&gt;
===Custom profile field names===&lt;br /&gt;
&lt;br /&gt;
These are optional and depend on whether you have created any custom profile fields in your site. The name of the header in file is of the form &#039;profile_field_xxxxx&#039; where xxxx is the unique shortname of custom user profile field name as you created it. &lt;br /&gt;
&lt;br /&gt;
The field name should match the case of the profile field shortname. So, for instance if the shortname of your custom profile field is all upper case, for example, &#039;&#039;DOB&#039;&#039;, then use a header of &#039;&#039;profile_field_DOB&#039;&#039; to match the case, not &#039;&#039;profile_field_dob&#039;&#039;, which will produce a &amp;quot;is not a valid field name&amp;quot; error. Likewise, a mixed case shortname such as &#039;&#039;Dob&#039;&#039; should have a header of &#039;&#039;profile_field_Dob&#039;&#039;. (The exception to this is if the shortname is all lower case, then any case will work in the field header, which is a historical quirk: but best practice is to match the case and you will avoid errors.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;profile_field_xxxxx&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are dates, use the ISO standard format YYYY-MM-DD, e.g. 2014-06-19 which will then be properly localized in the interfaced. For example, a field called dohire for date of hire, the fields could be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_dohire&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,1990-02-19&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,1996-06-05&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,1970-01-01 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are a menu, use the corresponding value in the menu list from field as you defined it. For example: a custom field &#039;corporatedivision&#039; with one of three values &#039;Management&#039;, &#039;Development&#039; or &#039;Training&#039;. Just insert one of those three words (e.g. &#039;Training&#039;) as the value for that field. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_corporatedivision&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,Management&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,Development&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,Training &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Special user change fields===&lt;br /&gt;
&lt;br /&gt;
Three special fields are used for managing user accounts, &#039;&#039;&#039;oldusername&#039;&#039;&#039;, &#039;&#039;&#039;deleted&#039;&#039;&#039; and &#039;&#039;&#039;suspended&#039;&#039;&#039;.  [[#Allow_renames|See below for details]].&lt;br /&gt;
&lt;br /&gt;
===Enrolment fields===&lt;br /&gt;
&lt;br /&gt;
You may optionally enrol users in already existing courses using manual enrolment. Only manual enrolment is done this way; if the manual enrolment method is disabled in a course, then no enrol is done.&lt;br /&gt;
&lt;br /&gt;
You use fields in the upload file of this type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;course1,type1,role1,group1,enroltimestart1,enrolperiod1,enrolstatus1,course2,type2,role2,group2,enroltimestart2,enrolperiod2,enrolstatus2&amp;lt;/pre&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
Header fields &#039;&#039;&#039;must&#039;&#039;&#039; have a numeric suffix such that type1,role1,group1,enrolperiod1 and enrolstatus1 all apply to course1 for course&#039;&#039;&#039;1&#039;&#039;&#039; to course&#039;&#039;&#039;n&#039;&#039;&#039;. Even if you are just doing one course enrolment, you must still use the number 1 on the heading name, i.e. course1,role1, etc. Do not use the bare headings without numbers, e.g. course,role, etc. as those will generate an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course#&#039;&#039;&#039; is the shortname of the course, if present the user will be enrolled in that course. Do not use the fullname of the course or it will generate an error. This field is the ONLY required field for a successful enrolment. All the others are optional. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type#&#039;&#039;&#039; sets the role to be used for the enrolment. A value of 1 is default course role,  2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;role#&#039;&#039;&#039; may be used to specify roles directly, using either role short name or the role id (numeric names of roles are not supported). Usually you will use the role name that is the shortname of the role as defined in Users &amp;gt;  Permissions &amp;gt; Define roles, e.g. student, editingteacher. If the role column is left out, the users will be enroled in the course with the default role, which is normally student.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;group#&#039;&#039;&#039; may be used to assign users to groups in course, using name or id (numeric group names are not supported). NOTE: if the group does not already exist, it will be created.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enroltimestart#&#039;&#039;&#039; may be used to set the enrolment start time, for each course. If not explicitly set here, the enrolment start time is set to be today. To set a date: &amp;quot;2021-02-15&amp;quot; and to set a date and time &amp;quot;2021-02-15 15:30&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolperiod#&#039;&#039;&#039; may be used to set the enrolment duration, in days, for each course. If not explicitly set here, all the users will get the duration as set in the Manual enrolment method of the course (which defaults to 0 meaning unlimited.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolstatus#&#039;&#039;&#039; is optional as by default all newly enrolled users are set to active. If used a value of 1, it will suspend users in the course and if a user is previously set as inactive / suspended then a value of 0 will unsuspend them and make them active again.&lt;br /&gt;
&lt;br /&gt;
=== Cohort membership assignment===&lt;br /&gt;
&lt;br /&gt;
You can assign users to any already existing Cohort by using only the &amp;quot;username&amp;quot; and the &amp;quot;Cohort ID&amp;quot; with just two fields in the file. Note that this is an exception to the usual case where the firstname, lastname and email address of the user are required.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cohort#&#039;&#039;&#039; is the form to use and like enrolment in courses, you have to add a number to each header, so cohort1,cohort2, etc.&lt;br /&gt;
&lt;br /&gt;
Internal cohort ID numbers or non-numeric Cohort IDs of existing cohorts must be used; do not use the full name as this is not allowed. (Note that cohort ID is what is usually known elsewhere as the &amp;quot;shortname&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Here is a sample CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,cohort1,cohort2&lt;br /&gt;
student1,nursing,2016class&lt;br /&gt;
student2,nursing,2014class&lt;br /&gt;
student3,nursing,2014class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MNet ===&lt;br /&gt;
&lt;br /&gt;
Existing [[MNet]]users can be added to courses, groups or cohorts as below by using the field header &#039;&#039;&#039;mnethostid&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#enrolling to courses: username+mnethostid+course required&lt;br /&gt;
#adding to group: username+mnethostid+course+group required&lt;br /&gt;
#adding to cohort: username+mnethostid+cohort required&lt;br /&gt;
#suspending/reviving accounts: username+mnethostid+suspended required&lt;br /&gt;
&lt;br /&gt;
All other operations are ignored. You can not add users, delete them or update them (such as change names or email, profile fields, etc.)&lt;br /&gt;
&lt;br /&gt;
=== Set system roles ===&lt;br /&gt;
Users may also be assigned to already defined system roles, using the shortname of the system role as defined in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; for roles with a system context defined.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sysrole1,sysrole2,sysrole3&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
Users may be uploaded to a system role (usually Manager or Course creator)  by entering the shortname of that role. Other roles can only be uploaded if they have already been assigned in the &#039;system&#039; context. See [[Creating custom roles]]. Multiple roles can be assigned using sysrole2, sysrole3, etc. fields. Note that the number suffix in no way relates to the number suffixes on the enrolment fields. The numbers must go up in sequence starting at 1.&lt;br /&gt;
&lt;br /&gt;
Unassigning system roles&lt;br /&gt;
Users can also be removed from a given system role by entering the shortname of that role prefixed with a minus symbol: &#039;-&#039;. If the user is currently assigned to that role, they are removed from it. If the user is not currently assigned to that system role, the field value is ignored. However, the field value must refer to a system role that does exist on the system, otherwise an error will occur.&lt;br /&gt;
[[File:GlobalRoles1.png|thumb|500px|center|Example of a file for uploading users with global/system roles]]&lt;br /&gt;
&lt;br /&gt;
==Upload user process==&lt;br /&gt;
&lt;br /&gt;
# Create file for uploading&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
# Add file to upload&lt;br /&gt;
# Upload users preview - check settings and default user profile settings&lt;br /&gt;
# Upload users preview - click &amp;quot;Upload users&amp;quot;&lt;br /&gt;
# Upload users results - shows list of users, exceptions made in upload and summary of number of users&lt;br /&gt;
# Upload users results - click &amp;quot;Continue&amp;quot;&lt;br /&gt;
# Returns to Upload users screen&lt;br /&gt;
&lt;br /&gt;
==Updating users preview==&lt;br /&gt;
There are various settings to better control the desired upload behaviour. These settings are found on the &amp;quot;Upload users preview&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: errors updating existing accounts can affect your users badly. &#039;&#039;&#039;&#039;&#039;Be careful&#039;&#039;&#039;&#039;&#039; when using the options to update.&lt;br /&gt;
&lt;br /&gt;
====Upload type====&lt;br /&gt;
The Upload type specifies how to handle existing accounts.&lt;br /&gt;
&lt;br /&gt;
;Add new only, skip existing users : is the default Moodle upload type. It creates a new user account for each new record in the uploaded file. If an existing username is found in the uploaded file matches an existing username, that record is &#039;&#039;&#039;skipped&#039;&#039;&#039;. By skipping the existing user account, the data in the existing record is not touched (in contrast to the &amp;quot;Add new and update existing users&amp;quot; option) and a second new user account is &#039;&#039;&#039;not&#039;&#039;&#039; created (in contrast to the &amp;quot;Add all, append number to usernames if needed&amp;quot; option). &lt;br /&gt;
&lt;br /&gt;
;Add all, append number to usernames if needed : creates a new user account for each record in the uploaded file. If an existing user account is found, a new account will be created with a number appended to the username. For example, if a user account for username &#039;jsmith&#039; already exists and a new record in the uploaded file contains a record forusername &#039;jsmith&#039; an additional user account is created with a 1 &#039;&#039;&#039;appended&#039;&#039;&#039; to the username to produce user &#039;jsmith1&#039;. &lt;br /&gt;
&lt;br /&gt;
;Add  new and update existing users : creates a new user account for each new user in the upload file. If an existing user account with the same username is found, the account information is &#039;&#039;&#039;updated&#039;&#039;&#039; by the data in the uploaded file. &lt;br /&gt;
&lt;br /&gt;
;Update existing users only : ignores any new users found in the upload file and updates the user account if a matching username record is found in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
====New user password====&lt;br /&gt;
When creating a new user account Moodle can create a new password (if one is not provided) or require a password in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
;Create password if needed and send via email: creates a random default password for each new user account if one is not provided in the uploaded file, and emails the user their user information and new password.&lt;br /&gt;
&lt;br /&gt;
;Field required in file : requires that a password be provided in the uploaded file in order. If a password is not provided, an error is generated and the user account is not created. No notification of this user information or password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
====Existing user details====&lt;br /&gt;
The Existing user details options are only available when the Upload type allows existing user accounts to be updated. It specifies how Moodle should process user detail information for existing users.&lt;br /&gt;
&lt;br /&gt;
;No changes : ignores user detail data in the uploaded file and leaves the existing user account data unchanged.&lt;br /&gt;
;Override with file : overwrites data in the existing user account with the data provided in the uploaded file.&lt;br /&gt;
;Override with file and defaults : overwrites data in the existing user account with data provided in the uploaded file and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
;Fill in missing from file and defaults : adds data in the existing user account with data provided in the uploaded file if the field is empty (does not already contain data) and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
&lt;br /&gt;
====Existing user password====&lt;br /&gt;
The Existing user password option appears when you you have set the &amp;quot;Existing user details&amp;quot; setting to &amp;quot;Overwrite with file&amp;quot;. It specifies how to handle password data for existing user accounts, to change them or leave them as it. This is a bit of insurance to make sure that you really want to mass change user passwords.&lt;br /&gt;
&lt;br /&gt;
;No changes : ignores password field in the uploaded user file and leaves the existing user account password untouched&lt;br /&gt;
;Update : overwrites the existing user account password with the password provided in the uploaded file&lt;br /&gt;
&lt;br /&gt;
====Force password change====&lt;br /&gt;
The Force password change option specifies when to tag a user account so that the next login attempt will require the user to change the user&#039;s password.&lt;br /&gt;
&lt;br /&gt;
;Users having a weak password : If the user account has a weak password as defined by the site&#039;s [[Password policy#Password policy|Password policy]] then the user will be forced to change the password during the next login attempt. This option is not shown if there the site does not have a [[Password policy#Password policy|Password policy]]. &lt;br /&gt;
;None : None of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
;All : All of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
&lt;br /&gt;
====Allow renames====&lt;br /&gt;
If the uploaded file contains the special &#039;&#039;&#039;oldusername&#039;&#039;&#039; field, it is possible to rename a user from the &#039;&#039;&#039;oldusername&#039;&#039;&#039; to a new &#039;&#039;&#039;username&#039;&#039;&#039;. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow renames. Keep in mind that renaming a user will require the user to use the new username when logging in.&lt;br /&gt;
;No : ignores the &#039;&#039;&#039;oldusername&#039;&#039;&#039; field and leaves the existing user account&#039;s username field unchanged.&lt;br /&gt;
;Yes : allows the existing user account&#039;s username to be changed by the data provided in the uploaded file&#039;s username field. The &#039;&#039;&#039;oldusername&#039;&#039;&#039; will be searched for and then updated with the data provided in the username column.&lt;br /&gt;
&lt;br /&gt;
====Allow deletes====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field, it is possible to use the upload file to delete existing user accounts. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow deletes. Keep in mind that deleting a user account will prevent that user from logging in. As a protection, site administrator user accounts cannot be deleted with this method. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account unchanged&lt;br /&gt;
;Yes : allows the existing user account to be deleted when the value of the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is 1. &lt;br /&gt;
&lt;br /&gt;
====Allow suspending and activating of accounts====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field, it is possible to use the upload file to either suspend or make active (unsuspend) existing user accounts. The default setting is to allow suspending/activating of existing user accounts. Keep in mind that suspending an existing user account will prevent that user from logging in. &lt;br /&gt;
;Yes : allows the existing user account to be suspended when the value of the &#039;&#039;&#039;suspended&#039;&#039;&#039; field is 1. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account status unchanged.&lt;br /&gt;
&lt;br /&gt;
====Prevent email address duplicates====&lt;br /&gt;
It is possible, but &#039;&#039;&#039;not&#039;&#039;&#039; recommended to upload users with duplicate email addresses. By default, uploading users with duplicate email addresses is prevented. To allow duplicate email addresses, go to Site administration ► Plugins ► Authentication ► Manage authentication. You can tick &amp;quot;Allow accounts with same email&amp;quot;. Then on the upload users screen you will be allowed to change the &amp;quot;Prevent email address duplicates&amp;quot; setting. &lt;br /&gt;
&lt;br /&gt;
However, doing this is not recommended for file uploads. Test thoroughly any user uploads before implementing.&lt;br /&gt;
&lt;br /&gt;
For more info, see the [[Managing authentication#Allow accounts with same email|Managing authentication]] docs page&lt;br /&gt;
;Yes : prevents user accounts from being created from the uploaded if an existing user account already has the same email address as found in the uploaded file&#039;s  &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
;No : allows user accounts to be created if an existing user account already has the same email address found in the uploaded file&#039;s  &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
&lt;br /&gt;
====Standardise usernames====&lt;br /&gt;
Standardise usernames is used by default to convert the username to all lower case and to strip out illegal characters. It is possible to not standardise the usernames; however, doing so is &#039;&#039;&#039;not&#039;&#039;&#039; recommended.&lt;br /&gt;
;Yes : standardises usernames found in the uploaded file before updating existing or creating new user accounts so that the username contains only lowercase letters and numbers.&lt;br /&gt;
;No : skips standardising usernames found in the uploaded file so that the newly created or updated usernames will be exactly as they are in the uploaded file (&#039;&#039;&#039;not recommended&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
For those seeking a more technical explanation, the process for standardising the usernames consists of ensuring the characters are all UTF-8 (fix_utf8) encoded, converting the username to lower case, and then stripping out non-letters/non-number characters (unless &#039;&#039;Site administration &amp;gt; Security &amp;gt; Site policies &amp;gt; Allow extended characters in usernames&#039;&#039; is set on) with something similar to: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$username = preg_replace(&#039;/[^-\.@_a-z0-9]/&#039;, &#039;&#039;, $username);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Select for bulk user actions====&lt;br /&gt;
After the uploaded file has finished being processed (all new accounts have been created and existing accounts updated as specified by the previous settings), there is an option to select some of those user accounts to perform additional [[admin/user/user bulk|bulk user actions]] such as &lt;br /&gt;
*Confirm user accounts created through Email-based self-registration which are not yet confirmed by the user&lt;br /&gt;
*Send a message (requires Messaging to be enabled)&lt;br /&gt;
*Delete user accounts&lt;br /&gt;
*Display a list of users on a page&lt;br /&gt;
*Download user data in text, ODS or Excel file format&lt;br /&gt;
*Force users to change their passwords&lt;br /&gt;
*Add users to a cohort&lt;br /&gt;
&lt;br /&gt;
By default, no users are selected for [[admin/user/user bulk|bulk user actions]].&lt;br /&gt;
&lt;br /&gt;
;No : No users are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;New users : Only newly created users are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;Updated users : Only updated user accounts are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;All users : All users found (existing updated users and newly created user accounts) in the uploaded file are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
&lt;br /&gt;
===Default values===&lt;br /&gt;
&lt;br /&gt;
You can provide default user values for some fields not included in the uploaded file. Some fields include:&lt;br /&gt;
&lt;br /&gt;
*Email display&lt;br /&gt;
*Forum auto-subscribe&lt;br /&gt;
*City/town&lt;br /&gt;
*ID number&lt;br /&gt;
*Institution&lt;br /&gt;
*Department&lt;br /&gt;
&lt;br /&gt;
By clicking the &#039;&#039;&#039;Show more....&#039;&#039;&#039; link, other default user profile fields will show up. You can set 17 different fields here, including the Authentication method, Country. Language, Timezone, as well as most other standard User profile fields.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Other fields&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have created any custom profile fields for your users, they will show up here.&lt;br /&gt;
&lt;br /&gt;
==Upload user results ==&lt;br /&gt;
After accepting the preview settings by clicking on &amp;quot;Upload users&amp;quot;, you should see the Upload users results screen.&lt;br /&gt;
[[File:Upload users results 2.0.JPG|thumb|center|The results screen; everything went well!]]&lt;br /&gt;
This screen will show you any exceptions or changes that were made to each user in the upload process.   For example, if you were updating user information, the updated information will be shown. Or if a user was not added that record will be highlighted.&lt;br /&gt;
&lt;br /&gt;
The screen will summarize how many users were uploaded or updated, indicate the number of weak passwords and the number of errors.&lt;br /&gt;
&lt;br /&gt;
==Advanced potentials of Upload user==&lt;br /&gt;
===Templates===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: This section needs checking and updating if necessary for Moodle 2.0. Please do so and remove this note when finished.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
*&amp;lt;nowiki&amp;gt; http://www.example.com/~%u/&amp;lt;/nowiki&amp;gt; results in  &amp;lt;nowiki&amp;gt;http://www.example.com/~jdoe/&amp;lt;/nowiki&amp;gt; (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example, if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3.&lt;br /&gt;
&lt;br /&gt;
===Deleting accounts===&lt;br /&gt;
&lt;br /&gt;
If the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &#039;&#039;&#039;username&#039;&#039;&#039;. After uploading the file, be sure to change the &amp;quot;Upload type&amp;quot; to &amp;quot;Update existing users only&amp;quot; and the &amp;quot;Allow deletes&amp;quot; option to &amp;quot;Yes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039;  A similar field is available for &#039;&#039;&#039;suspended&#039;&#039;&#039;. This enables a user account to be temporarily disabled rather than completely removed.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username,firstname,lastname,deleted&lt;br /&gt;
 jonest,Tom,Jones,0&lt;br /&gt;
 reznort,,,1&lt;br /&gt;
&lt;br /&gt;
==Encoding file format==&lt;br /&gt;
On the initial Upload user screen, you may select the file encoding format from a pull down list.  These include UTF-8 (the default), ASCII,  ISO-8859-1 to ISO-8859-11 or any one of over 36 formats.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
The upload will also fail if you have trailing spaces at the end of your data fields. Often, this can not be removed with a simple Find &amp;quot; &amp;quot; and Replace with &amp;quot;&amp;quot;. If information has been copied from web sources than it is possible to include non-breaking spaces which will prevent your upload from being completed correctly. To find these invisible spaces, use the Find and Replace function in Excel. In the find field, hold alt and type 0160. Leave the replace field blank. &lt;br /&gt;
&lt;br /&gt;
===Field size limits===&lt;br /&gt;
Some fields have maximum character lengths, as defined in the database fields.  Typically the file will import to the preview list screen but not finish the process. Turn on debug to see the fields that are too long. The error will be &amp;quot;User not added - error&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The sizes of some common fields, in number of characters, are currently (3.2):&lt;br /&gt;
&lt;br /&gt;
*username - 100 	 &lt;br /&gt;
*password - 255 	 &lt;br /&gt;
*idnumber - 255 	 &lt;br /&gt;
*firstname - 100 	 &lt;br /&gt;
*lastname - 100 	 &lt;br /&gt;
*lastnamephonetic - 255 	 &lt;br /&gt;
*firstnamephonetic - 255 	 &lt;br /&gt;
*middlename - 255 	 &lt;br /&gt;
*alternatename - 255 &lt;br /&gt;
*institution -  255 	 &lt;br /&gt;
*department - 255 	 &lt;br /&gt;
*address - 255 	 &lt;br /&gt;
*city - 120 	 &lt;br /&gt;
*icq -15 	 &lt;br /&gt;
*skype - 50 	 &lt;br /&gt;
*yahoo - 50 	 &lt;br /&gt;
*aim - 50&lt;br /&gt;
*msn - 50 	 &lt;br /&gt;
*phone1 - 20 	 &lt;br /&gt;
*phone2  - 20&lt;br /&gt;
&lt;br /&gt;
===All user fields listed here===&lt;br /&gt;
:All the user fields that are valid in an upload file are listed below, except for any custom fields you may have created (for which see below.)&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;firstname,lastname,username,email,password,auth,idnumber,institution,department,city,country,timezone,lang,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,skype,msn,aim,yahoo,icq,phone1,phone2,address,url,description,descriptionformat,interests,oldusername,deleted,suspended,alternatename,lastnamephonetic,firstnamephonetic,middlename&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The enrolments into courses information are &amp;lt;pre&amp;gt;course1,type1,role1,group1,enrolperiod1,enrolstatus1&amp;lt;/pre&amp;gt; &lt;br /&gt;
where each enrolment is grouped by number.&lt;br /&gt;
&lt;br /&gt;
===Capabilities===&lt;br /&gt;
&lt;br /&gt;
You may wish to create a limited role to allow some users access to this function. Create a role at the system/site level with the following capabilities allowed:&lt;br /&gt;
* moodle/site:uploadusers&lt;br /&gt;
* moodle/role:assign&lt;br /&gt;
&lt;br /&gt;
And &lt;br /&gt;
* In &#039;Allow role assignments&#039; tab of this new role, permit it to assign the required roles that it may be uploading, especially Student, but also Teacher, Non-editing Teacher, and any other custom roles you may have created, which will be used in the uploads to assign users to.&lt;br /&gt;
&lt;br /&gt;
In particular, don&#039;t forget the moodle/role:assign capability (even if these users have it in the courses they will be enrolling users in - it won&#039;t work).&lt;br /&gt;
&lt;br /&gt;
==Upload users via CLI==&lt;br /&gt;
&lt;br /&gt;
In Moodle 3.10 onwards, an administrator can upload users via a CLI script.&lt;br /&gt;
&lt;br /&gt;
To obtain instructions on how to use the script, in the command line from the moodle directory run &lt;br /&gt;
 php admin/tool/uploaduser/cli/uploaduser.php --help&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Flat file]] enrolment&lt;br /&gt;
* [[User profile fields]] for details of how to include data about custom user profile fields in the upload users file&lt;br /&gt;
* [[Upload courses]]&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[de:Nutzerliste hochladen]]&lt;br /&gt;
[[es:Subir usuarios]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Administration_via_command_line&amp;diff=142650</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Administration_via_command_line&amp;diff=142650"/>
		<updated>2021-12-05T14:40:39Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Scheduled tasks */ Added ad hoc tasks script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
==Running CLI scripts==&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins may provide CLI functionality via scripts in their own &amp;lt;code&amp;gt;cli&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or www-data or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
{{Note|These scripts are supposed to be run under the identity of the web server user. Examples on this page use the &amp;lt;tt&amp;gt;apache&amp;lt;/tt&amp;gt; user for illustration. The particular value depends on your OS distribution and local set-up. Typical values may be &amp;lt;tt&amp;gt;apache&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;www-data&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;httpd&amp;lt;/tt&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
== Upgrading ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
There are two modes of installing Moodle from the command line. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
If your arguments contain some specials characters for Linux-based systems, don&#039;t forget to &#039;&#039;escape&#039;&#039; them with a backslash. For example, if you want to create an admin with &#039;&#039;pa$sword&#039;&#039; as password you should wrote &#039;&#039;pa\$sword&#039;&#039; instead!&lt;br /&gt;
&lt;br /&gt;
If required, the database install may be skipped, with just config.php populated.&lt;br /&gt;
&lt;br /&gt;
   $ sudo -u apache /usr/bin/php admin/cli/install.php --skip-database&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn maintenance mode off, execute the same script with the --disable parameter:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to enable maintenance mode immediately, but show a countdown to your users, execute the same script with the --enablelater parameter and the number of minutes which the countdown should run:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enablelater=10&lt;br /&gt;
&lt;br /&gt;
This script will also create and remove the climaintenance.html file for &amp;quot;Offline&amp;quot; mode.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults on Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user on the site), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
==Converting InnoDB tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Sites using MySQL with database tables using Antelope as the file format are recommended to convert the tables to the Barracuda file format.&lt;br /&gt;
&lt;br /&gt;
This is because tables using Antelope as the file format cannot handle more than 10 text columns. This file formats only supports &#039;&#039;compact&#039;&#039; and &#039;&#039;redundant&#039;&#039; row formats for backward compatibility reasons. This may cause a problem on larger sites when restoring a course, in which case the following error will be displayed: &lt;br /&gt;
&lt;br /&gt;
 Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
Barracuda is the newest innoDB file format. In addition to supporting &#039;&#039;compact&#039;&#039; and &#039;&#039;redundant&#039;&#039; row formats, Barracuda also supports &#039;&#039;compressed&#039;&#039; and &#039;&#039;dynamic&#039;&#039; row formats. &lt;br /&gt;
&lt;br /&gt;
However, converting tables to Barracuda is only recommended, and not required, since not all MySQL users are affected. (It may only be a problem for larger sites.)&lt;br /&gt;
&lt;br /&gt;
===Tool for converting tables===&lt;br /&gt;
&lt;br /&gt;
A command line tool is included in Moodle for converting tables to Barracuda.&lt;br /&gt;
&lt;br /&gt;
To view tables requiring conversion, use the list option:&lt;br /&gt;
&lt;br /&gt;
 $ php admin/cli/mysql_compressed_rows.php --list&lt;br /&gt;
&lt;br /&gt;
Here is an example output:&lt;br /&gt;
&lt;br /&gt;
 mdl_data                            Compact     (needs fixing) &lt;br /&gt;
 mdl_data_fields                     Compact     (needs fixing)&lt;br /&gt;
 mdl_enrol_paypal                    Compact     (needs fixing)&lt;br /&gt;
&lt;br /&gt;
To proceed with the conversion, run the command using the fix option:&lt;br /&gt;
&lt;br /&gt;
 $ php admin/cli/mysql_compressed_rows.php --fix&lt;br /&gt;
&lt;br /&gt;
Successful table conversion will be reported in the output, for example:&lt;br /&gt;
&lt;br /&gt;
 mdl_data                   ... Compressed&lt;br /&gt;
 mdl_data_fields            ... Compressed&lt;br /&gt;
 mdl_enrol_paypal           ... Compressed&lt;br /&gt;
&lt;br /&gt;
Please note that the commands must be executed on your moodle directory. Once tables are fixed, the warning message will no longer be displayed.&lt;br /&gt;
 &lt;br /&gt;
For further information on InnoDB file formats see the [http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope MySQL InnoDB glossary - Antelope] and the [http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda MySQL InnoDB glossary - Barracuda].&lt;br /&gt;
&lt;br /&gt;
If you get errors due to having insufficient privileges to run these commands (this is quite likely) then the easiest solution is to generate the required SQL commands using,&lt;br /&gt;
&lt;br /&gt;
 $ php admin/cli/mysql_compressed_rows.php --showsql&lt;br /&gt;
&lt;br /&gt;
You can then copy the generated SQL into your mysql client running as the &#039;root&#039; user.&lt;br /&gt;
&lt;br /&gt;
==Converting to the new character set and collation==&lt;br /&gt;
&lt;br /&gt;
 $ php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/cli/scheduled_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
 --showsql - Shows sql queries before they are execute&lt;br /&gt;
&lt;br /&gt;
 --showdebugging - Shows developer debugging info&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;php admin/cli/scheduled_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
 php admin/cli/scheduled_task.php --execute=&#039;\enrol_imsenterprise\task\cron_task&#039;&lt;br /&gt;
&lt;br /&gt;
Be aware of the single quotes. Without them, you would need to use double backlashes to avoid escaping by the shell.&lt;br /&gt;
&lt;br /&gt;
=== Ad hoc tasks ===&lt;br /&gt;
[[Cron#Low_latency_adhoc_tasks|Ad hoc tasks]] are low-latency tasks that are normally run by the cron. You can run just the queued ad hoc tasks with admin/cli/adhoc_task.php.&lt;br /&gt;
&lt;br /&gt;
This script accepts the following options and arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 -h, --help                Print out this help&lt;br /&gt;
     --showsql             Show sql queries before they are executed&lt;br /&gt;
     --showdebugging       Show developer level debugging information&lt;br /&gt;
 -e, --execute             Run all queued adhoc tasks&lt;br /&gt;
 -k, --keep-alive=N        Keep this script alive for N seconds and poll for new adhoc tasks&lt;br /&gt;
 -i  --ignorelimits        Ignore task_adhoc_concurrency_limit and task_adhoc_max_runtime limits&lt;br /&gt;
 -f, --force               Run even if cron is disabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example to run the currently queued ad hoc tasks:&lt;br /&gt;
&lt;br /&gt;
 sudo -u apache php admin/cli/adhoc_task.php -e&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Purge caches==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Kill all sessions==&lt;br /&gt;
If needed for administrative reasons, you can kill all user sessions using this script:&lt;br /&gt;
&lt;br /&gt;
 php admin/cli/kill_all_sessions.php&lt;br /&gt;
&lt;br /&gt;
As a result, all users will be logged out from Moodle.&lt;br /&gt;
&lt;br /&gt;
==Backup and restore of large courses==&lt;br /&gt;
&lt;br /&gt;
See Backup via CLI in [[Course backup]] and Restore via CLI in [[Course restore]] (new in 3.10 onwards).&lt;br /&gt;
&lt;br /&gt;
==Fix course / module sequences==&lt;br /&gt;
&lt;br /&gt;
In rare cases (such as after upgrading from a very old version of Moodle), the course / section / module sequence data can be out of sync. This can cause various problems for affected courses, such as sections not appearing, backups failing, pages not displaying etc. There is a specific check to check for errors caused by this problem, and to fix the data in the database if they are found. To run this script please use the command below:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/fix_course_sequence.php -c=* --fix&lt;br /&gt;
&lt;br /&gt;
This will check every course in Moodle and report which ones had errors and were fixed.&lt;br /&gt;
&lt;br /&gt;
==Fix orphaned question categories==&lt;br /&gt;
&lt;br /&gt;
When a quiz is created, a new question category for the quiz is automatically created. In versions of Moodle prior to 2.9.1, if the quiz is deleted, the question category and any questions in the category remain in database. These orphaned question categories may be fixed by running the admin/cli/fix_orphaned_question_categories.php script with the --fix option.&lt;br /&gt;
&lt;br /&gt;
==Search and replace text==&lt;br /&gt;
&lt;br /&gt;
This script can be used to search and replace text throughout the whole database. Use carefully and backup first always. More info in [[Search and replace tool]].&lt;br /&gt;
&lt;br /&gt;
  php admin/tool/replace/cli/replace.php --search=//oldsitehost --replace=//newsitehost&lt;br /&gt;
&lt;br /&gt;
==Build theme CSS cache==&lt;br /&gt;
&lt;br /&gt;
If Moodle is not running in theme designer mode it will keep a copy of the compiled CSS on local disk and serve that to the browser when it requests a page. If there isn&#039;t a copy on local disk then a copy will be built the first time a page within Moodle is requested. &lt;br /&gt;
&lt;br /&gt;
With this script you can pre-compile the cached CSS files for themes within Moodle to avoid having a user wait for the theme to compile during the first page request.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/build_theme_css.php --themes=boost&lt;br /&gt;
&lt;br /&gt;
==Get and set configuration values==&lt;br /&gt;
&lt;br /&gt;
Displays the current value of the given setting, or set the given setting to the specified value.&lt;br /&gt;
&lt;br /&gt;
 $ php admin/cli/cfg.php [--component=&amp;lt;componentname&amp;gt;] [--json] [--shell-arg]&lt;br /&gt;
 $ php admin/cli/cfg.php --name=&amp;lt;configname&amp;gt; [--component=&amp;lt;componentname&amp;gt;] [--shell-arg] [--no-eol]&lt;br /&gt;
 $ php admin/cli/cfg.php --name=&amp;lt;configname&amp;gt; [--component=&amp;lt;componentname&amp;gt;] --set=&amp;lt;value&amp;gt;&lt;br /&gt;
 $ php admin/cli/cfg.php --name=&amp;lt;configname&amp;gt; [--component=&amp;lt;componentname&amp;gt;] --unset&lt;br /&gt;
 $ php admin/cli/cfg.php [--help|-h]&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
 $ php admin/cli/cfg.php --name=langmenu&lt;br /&gt;
will display the value of &#039;&#039;Display language menu&#039;&#039; in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language settings&#039;&#039; (0 for &#039;&#039;No&#039;&#039; or 1 for &#039;&#039;Yes&#039;&#039;).&lt;br /&gt;
 $ php cfg.php --name=maxsizetodownload --component=folder&lt;br /&gt;
will display the value of &#039;&#039;Maximum folder download size (MB)&#039;&#039; accessible from &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Folder&#039;&#039;.&lt;br /&gt;
 $ php admin/cli/cfg.php --name=langmenu --set=0&lt;br /&gt;
will disable the &#039;&#039;Language menu&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* MDL-35736 - Manage plugins via command line&lt;br /&gt;
* MDL-36237 - Resort course list via CLI&lt;br /&gt;
* [http://moosh-online.com/ MOOSH] - MOOdle SHell. It is a commandline tool that will allow you to perform most common Moodle tasks.&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;br /&gt;
[[it:Amministrazione via linea di comando]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Standard_themes&amp;diff=141675</id>
		<title>Standard themes</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Standard_themes&amp;diff=141675"/>
		<updated>2021-09-13T09:12:51Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: &amp;quot;Note:&amp;quot; prefix added by wiki, changed &amp;lt;code&amp;gt; to &amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Themes}}&lt;br /&gt;
{{Note|Clean, More and Bootstrapbase have been removed from core in Moodle 3.7. You are advised to use the [[Classic theme]] instead.}}&lt;br /&gt;
==Standard themes==&lt;br /&gt;
&lt;br /&gt;
Moodle has two standard themes: &#039;&#039;[[Boost theme|Boost]]&#039;&#039;  and &#039;&#039;[[Classic theme|Classic]],&#039;&#039; a responsive, bootstrap-based theme combining the navigation structure of the deprecated Clean and More themes and the customisation options of the Boost theme.&lt;br /&gt;
&lt;br /&gt;
Other themes are available from the [https://moodle.org/plugins/browse.php?list=category&amp;amp;id=3 Themes section of the Moodle plugins directory].&lt;br /&gt;
&lt;br /&gt;
===Example of a customised Boost theme===&lt;br /&gt;
[[File:SchoolDemoBoost.png|thumb|center|600px]]&lt;br /&gt;
&lt;br /&gt;
The Moodle School demo site, [http://school.moodledemo.net Mount Orange], uses standard Boost with customisations as follows:&lt;br /&gt;
* An image for the front page and a background image need to be uploaded and referenced in the code.&lt;br /&gt;
*&#039;&#039;&#039;Front page topic section:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;frontpage container-fluid&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;div class=&amp;quot;jumbotron jumbotron-fluid&amp;quot; style=&amp;quot;background-image: url(&#039;YOUR UPLOADED FRONT PAGE IMAGE.jpg&#039;);&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;texts&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;YOUR HEADING&amp;lt;/h2&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;lead&amp;quot;&amp;gt;SENTENCE/TAG LINE&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;fp-block col-md-6&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h3&amp;gt;SMALLER HEADING&amp;lt;/h3&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Paragraph of text&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;button&amp;quot;&amp;gt;&amp;lt;a class=&amp;quot;btn btn-primary&amp;quot; href=&amp;quot;BUTTON LINK URL&amp;quot;&amp;gt;BUTTON TEXT »&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;fp-block col-md-6&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h3&amp;gt;SMALLER HEADING&amp;lt;/h3&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Paragraph of text.&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;button&amp;quot;&amp;gt;&amp;lt;a class=&amp;quot;btn btn-primary&amp;quot; href=&amp;quot;BUTTON LINK URL&amp;quot;&amp;gt;BUTTON TEXT »&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Boost theme Advanced settings - Raw initial SCSS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
$brand-primary:             #0070a8;&lt;br /&gt;
$body-color:                  #336;&lt;br /&gt;
$font-family-sans-serif:  &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif;&lt;br /&gt;
$breadcrumb-bg:           #fff;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Boost theme Advanced settings - Raw SCSS:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
body {&lt;br /&gt;
    background-image: url(&amp;quot;YOUR UPLOADED BACKGROUND IMAGE.png&amp;quot;);&lt;br /&gt;
    background-size: cover;&lt;br /&gt;
    background-repeat: no-repeat;&lt;br /&gt;
    background-attachment: fixed;&lt;br /&gt;
    letter-spacing: .3px;&lt;br /&gt;
}&lt;br /&gt;
h1, h2, h3, h4, h5, h6 {&lt;br /&gt;
    color: #f98012;&lt;br /&gt;
    font-weight: normal;&lt;br /&gt;
}&lt;br /&gt;
.navbar-brand {&lt;br /&gt;
    display: none;&lt;br /&gt;
}&lt;br /&gt;
#nav-drawer {&lt;br /&gt;
    background-color: rgba(236, 238, 239, .9);&lt;br /&gt;
}&lt;br /&gt;
#page-header.row {&lt;br /&gt;
    margin-left: -30px;&lt;br /&gt;
    margin-right: -30px;&lt;br /&gt;
}&lt;br /&gt;
#page-header .card {&lt;br /&gt;
    background-color: transparent;&lt;br /&gt;
    border: none;&lt;br /&gt;
    margin-bottom: 0;&lt;br /&gt;
}&lt;br /&gt;
#page-header h1 { &lt;br /&gt;
    color: #fff;&lt;br /&gt;
    font-weight: 500;&lt;br /&gt;
    text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); &lt;br /&gt;
}&lt;br /&gt;
#page-header .breadcrumb {&lt;br /&gt;
    padding: .50rem 1rem;&lt;br /&gt;
}&lt;br /&gt;
.block-region .card-block .card-title {&lt;br /&gt;
    color: #f98012;&lt;br /&gt;
    font-size: 1.07rem;&lt;br /&gt;
    font-weight: 400;&lt;br /&gt;
}&lt;br /&gt;
#page-footer a {&lt;br /&gt;
    color: #f98012;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index #page-header {&lt;br /&gt;
    display:none;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index #region-main .card.card-block {&lt;br /&gt;
    padding: 0;&lt;br /&gt;
    border: 0;&lt;br /&gt;
    background-color: transparent;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index #block-region-side-pre {&lt;br /&gt;
    margin-top: 15px;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index .label {&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index .activity &amp;gt; div {&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index .mod-indent-outer {&lt;br /&gt;
    padding-left: 0;&lt;br /&gt;
}&lt;br /&gt;
#page-site-index .contentwithoutlink {&lt;br /&gt;
    padding-right: 0;&lt;br /&gt;
}&lt;br /&gt;
.frontpage.container-fluid {&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .jumbotron {&lt;br /&gt;
    padding:0;&lt;br /&gt;
    border-radius:0;&lt;br /&gt;
    background: transparent no-repeat right bottom / cover;&lt;br /&gt;
    line-height: 250px;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .jumbotron .texts {&lt;br /&gt;
    color: #fff;&lt;br /&gt;
    letter-spacing: .5px;&lt;br /&gt;
    background-color: rgba(255, 99, 0, 0.70);&lt;br /&gt;
    padding: 0 20px;&lt;br /&gt;
    margin-bottom:20px;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    vertical-align: bottom;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .jumbotron h2 {&lt;br /&gt;
    color: #fff;&lt;br /&gt;
    font-size: 32px;&lt;br /&gt;
    font-weight: 300;&lt;br /&gt;
    text-shadow: 1px 1px 1px #444;&lt;br /&gt;
    margin-bottom: 0;&lt;br /&gt;
    margin-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .jumbotron .lead {&lt;br /&gt;
    text-shadow: 1px 1px 1px #333;&lt;br /&gt;
    line-height: 30px;&lt;br /&gt;
    font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .row-fluid {&lt;br /&gt;
    line-height: 24px;&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    padding: 10px 20px 20px;&lt;br /&gt;
    box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .row-fluid::after {&lt;br /&gt;
    display: table;&lt;br /&gt;
    content: &amp;quot;&amp;quot;;&lt;br /&gt;
    clear: both;&lt;br /&gt;
    line-height: 0;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .fp-block {&lt;br /&gt;
    padding: 10px 20px 0;&lt;br /&gt;
}&lt;br /&gt;
.frontpage h3 {&lt;br /&gt;
    font-size: 26px;&lt;br /&gt;
    line-height: 30px;&lt;br /&gt;
    font-weight: 300;&lt;br /&gt;
    margin-top: 20px;&lt;br /&gt;
    margin-bottom: 20px;&lt;br /&gt;
}&lt;br /&gt;
.frontpage .button {&lt;br /&gt;
    text-align: right;&lt;br /&gt;
}&lt;br /&gt;
.empty-region-side-pre.empty-region-side-post #region-main-box,&lt;br /&gt;
.empty-region-side-pre.empty-region-side-post #region-main {&lt;br /&gt;
  width: 100%;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
#settingsnav.box.block_tree_box.p-y-1 {&lt;br /&gt;
    padding-top: 0!important;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Theme selector==&lt;br /&gt;
&lt;br /&gt;
An administrator can set a theme for the site in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme selector&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Different themes may be set according to &#039;device type&#039; - default, legacy (for older browsers), mobile and tablet.&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme selector&#039;&#039;&lt;br /&gt;
*Click on the &amp;quot;Select theme&amp;quot; button next to the type you wish to change&lt;br /&gt;
*Scroll down to see the previews of the available themes and click on the &amp;quot;Use theme&amp;quot; button to chose the theme&lt;br /&gt;
*The next screen will provide information about the theme. Click &amp;quot;Continue&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note 1: Moodle caches themes so if you don&#039;t immediately see changed settings that you were expecting, click the &amp;quot;Clear theme caches&amp;quot; button at the top of the Theme selector page.&lt;br /&gt;
&lt;br /&gt;
Note 2: The selected theme may be overridden if user/course or category themes have been allowed in the [[Theme settings]].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Boost theme]]&lt;br /&gt;
* [[More theme]]&lt;br /&gt;
* [[Theme credits]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=189573 What counts as a &#039;legacy&#039; device type?] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[de:Standard-Designs]]&lt;br /&gt;
[[es:Temas estándar]]&lt;br /&gt;
[[fr:Thèmes standards]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Universal_Office_Converter_(unoconv)&amp;diff=141612</id>
		<title>Universal Office Converter (unoconv)</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Universal_Office_Converter_(unoconv)&amp;diff=141612"/>
		<updated>2021-08-31T14:31:19Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Installing unoconv on Windows */ Tidied up formatting and changes for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Document converters}}&lt;br /&gt;
==What is unoconv?==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;unoconv&amp;quot; is a command line program that is used to convert between different office document file formats. It uses an instance of [http://libreoffice.org LibreOffice] to do the conversion and is used by the [[Assignment activity]] to convert documents to pdf so that they can be annotated. If unoconv is not installed - the only impact is that the assignment activities will only allow annotations when students upload a pdf document. &lt;br /&gt;
&lt;br /&gt;
The steps required to install unoconv are different depending on the operating system that you have installed Moodle on. &lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on Linux ==&lt;br /&gt;
The required version of unoconv is at least 0.7. Depending on your flavour of linux, this may be available in your package manager and you can install it directly with:&lt;br /&gt;
&lt;br /&gt;
===Ubuntu 18.04 LTS===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install unoconv&lt;br /&gt;
mkdir /var/www/.config&lt;br /&gt;
chown www-data:www-data /var/www/.config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu 16.04 LTS===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your package manager contains an older version of the package, you will have to find a newer version and install it manually ([https://packages.debian.org/stretch/unoconv Debian Testing]). Unoconv itself is just a python script, so it has few dependencies.&lt;br /&gt;
&lt;br /&gt;
Potential problems:&lt;br /&gt;
* On some systems the apache user home directory is set to a non existent folder. This can cause unoconv to fail. There are 2 solutions to this - one is to make a (writable) home directory for the apache user (like /home/www-data). The other is to run a unoconv listener (described below) as another user other than the apache user (someone with a valid, writable home directory).&lt;br /&gt;
* If you are still running 14.04LTS then unoconv won&#039;t work as shipped. This might not be the most efficient route but it worked by first installing unoconv (version 0.6) from the package manager as above. You will then need to grab unoconv 0.7 from Github (https://github.com/dagwieers/unoconv), then upgrade to the latest libreoffice using the PPA (https://launchpad.net/~libreoffice/+archive/ubuntu/ppa). Point moodle at the Github version of unoconv. You need to modify the Python unoconv file by changing &#039;python&#039; in the first line to &#039;python3&#039;. You also need to change the permissions on the directory /var/www so that the user www-data can write to it (www-data needs to write to its home directory which it cannot do by default).&lt;br /&gt;
On Debian Stable, the cleanest method to install [https://packages.debian.org/jessie-backports/unoconv unoconv] is using Jessie-backports. First, enable backports repo line in /etc/apt/sources.list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#### Jessie-backports  ####&lt;br /&gt;
deb http://ftp.debian.org/debian jessie-backports main&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, update and install unoconv from jessie-backports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get update&lt;br /&gt;
apt-get install -t jessie-backports unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The package will bring all necessary dependencies for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Ubuntu 14.04 LTS===&lt;br /&gt;
&lt;br /&gt;
1) Navigate to opt directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /opt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Download unoconv&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo wget https://raw.githubusercontent.com/dagwieers/unoconv/master/unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Modify the Python unoconv file by changing &#039;python&#039; in the first line to &#039;python3&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /opt/unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
eg. &amp;lt;pre&amp;gt;#!/usr/bin/env python3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Make unoconv executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod ugo+x /opt/unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Add LibreOffice PPA to your system and install the latest version&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo add-apt-repository ppa:libreoffice/ppa&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install libreoffice&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6) Change permissions so apache can write to its home directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown www-data /var/www&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7) From your browser navigate to&lt;br /&gt;
&#039;&#039;Site administration &amp;gt; Server &amp;gt; System paths&#039;&#039; and add the path to unoconv&amp;lt;br&amp;gt;&lt;br /&gt;
/opt/unoconv&lt;br /&gt;
*Note: if you would like to preserve the default path add a symbolic link to /usr/bin: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s /opt/unoconv /usr/bin/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8) Navigate to &lt;br /&gt;
&#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Assignment &amp;gt; Feedback plugins &amp;gt; Annotate PDF &amp;gt; Test unoconv path&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
You should see: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;The unoconv path appears to be properly configured.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
*Download the converted pdf test file. (if the PDF fails to load ensure that www-data can write to its home directory: /var/www)&lt;br /&gt;
&lt;br /&gt;
===CentOS / RedHat===&lt;br /&gt;
Just before you start, you might like to consider installing the latest [http://www.tecmint.com/install-libreoffice-on-rhel-centos-fedora-debian-ubuntu-linux-mint/ LibreOffice 6.3.2] directly from RPM packages, that are not part of the distribution you are using.&lt;br /&gt;
As of nov-2016, CentOS and RedHat 7.2 comes with OpenOffice 4.3 . so if you are not interested in using this version and would like to install latest 6.3 independent LibreOffice 6.3 , please remove any openoffice packages you might have on your OS by issuing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum remove openoffice* libreoffice*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is recommended to chose your localized libreoffice version for better document conversions. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install libreoffice libreoffice-pyuno&lt;br /&gt;
git clone https://github.com/dagwieers/unoconv.git&lt;br /&gt;
# copy &lt;br /&gt;
cp unoconv/unoconv /usr/bin&lt;br /&gt;
# or link unoconv to /usr/bin&lt;br /&gt;
ln -s unoconv/unoconv /usr/bin/unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 Note: depends on what version you are installing, openoffice or libreoffice, make sure you installed the *-pyuno package. (the headless package is already compiled into the core)&lt;br /&gt;
&lt;br /&gt;
Make sure it is properly configured:&lt;br /&gt;
http://your-moodle/admin/search.php?query=unoconv&lt;br /&gt;
&lt;br /&gt;
Production servers should consider running unoconv in listener mode, see [[Installing_unoconv#Run_a_unoconv_listener]] or follow directions bellow&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vi /etc/systemd/system/unoconv.service&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then copy and paste the following configuration into it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Unoconv listener for document conversions&lt;br /&gt;
Documentation=https://github.com/dagwieers/unoconv&lt;br /&gt;
After=network.target remote-fs.target nss-lookup.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
Environment=&amp;quot;UNO_PATH=/usr/lib64/libreoffice/program&amp;quot;&lt;br /&gt;
ExecStart=/usr/bin/unoconv --listener&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then enable and start the above service&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl enable unoconv.service&lt;br /&gt;
systemctl start unoconv.service&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your selinux is enable yous should set &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#setsebool -P httpd_execmem on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on OS X ==&lt;br /&gt;
Download and install LibreOffice for Mac. Unfortunately - newer versions of LibreOffice are not currently compatible with unoconv for mac and you will have to install LibreOffice 4.2 (Direct download link - https://downloadarchive.documentfoundation.org/libreoffice/old/4.2.5.2/mac/x86_64/LibreOffice_4.2.5.2_MacOS_x86-64.dmg).&lt;br /&gt;
&lt;br /&gt;
Get the latest version of the unoconv python script. One way to do this is with http://brew.sh/ brew.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven&#039;t done it already - install ghostscript. One way to install ghostscript is also with http://brew.sh/ brew&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install ghostscript&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the paths to unoconv and ghostscript in Moodle (&#039;&#039;Site administration &amp;gt; Server &amp;gt; System paths&#039;&#039;). If you used brew, they will both be installed to /usr/local/bin.&lt;br /&gt;
&lt;br /&gt;
LibreOffice needs write access to the current users home directory to create some temporary files. When unoconv is run as the webserver user (_www) it does not normally have this permission.&lt;br /&gt;
&lt;br /&gt;
There are some ways to get around this - one way is just to give the &amp;quot;_www&amp;quot; user write access to /Library/WebServer. &lt;br /&gt;
&lt;br /&gt;
Another solution is to convince LibreOffice that this users home directory is somewhere else. This can be done by inserting this code into the top of the unoconv python script.&lt;br /&gt;
Code to insert:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Set home to a writable folder. &lt;br /&gt;
os.environ[&#039;HOME&#039;] = &#039;/tmp/&#039;                                                                                                        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This needs to be inserted at line 36 immediately after the line &amp;quot;exitcode = 0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on Windows ==&lt;br /&gt;
Download and install LibreOffice for Windows. Open Office will work just as well, but the documentation for unonconv is set to Libre Office. &lt;br /&gt;
&lt;br /&gt;
Download the latest version of the unoconv script from https://github.com/dagwieers/unoconv/releases (download the zip version). &lt;br /&gt;
&lt;br /&gt;
From the downloaded zip file - extract the one file &#039;&#039;&#039;unoconv-0.7\unoconv&#039;&#039;&#039; (no file extension). This is the unoconv script - none of the other files in the package are required. &lt;br /&gt;
&lt;br /&gt;
Rename the downloaded script to &#039;&#039;&#039;unoconv.py&#039;&#039;&#039; and copy it to a folder in either &#039;&#039;&#039;C:\Program Files&#039;&#039;&#039; or &#039;&#039;&#039;C:\Program Files (x86)&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Create a batch file in the same folder as &#039;&#039;&#039;unoconv.py&#039;&#039;&#039; name it something like &#039;&#039;&#039;unoconv.bat&#039;&#039;&#039;, it must be a batch file, with these contents:&lt;br /&gt;
&lt;br /&gt;
 @&amp;quot;C:\Program Files\LibreOffice\program\python.exe&amp;quot; c:\unoconv\unoconv.py %*&lt;br /&gt;
&lt;br /&gt;
or:&lt;br /&gt;
&lt;br /&gt;
 @&amp;quot;C:\Program Files\OpenOffice\program\python.exe&amp;quot; c:\unoconv\unoconv.py %*&lt;br /&gt;
&lt;br /&gt;
Next, you have to &#039;&#039;&#039;Set paths in Moodle.&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Login as admin and go to &#039;&#039;Site administration &amp;gt; Server &amp;gt; System paths&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set:  &lt;br /&gt;
&#039;&#039;Path to Ghostscript (pathtogs)&#039;&#039; to &amp;lt;code&amp;gt;C:\Program Files\gs\gsversion\bin\gswin64c.exe&amp;lt;/code&amp;gt;.&lt;br /&gt;
Do not use gswin32.exe or gswin64.exe, these are not command line programs - use gswin32c.exe or gswin64c.exe. &lt;br /&gt;
&lt;br /&gt;
Set:  &lt;br /&gt;
&#039;&#039;Path to Python (pathtopython)&#039;&#039; to &amp;lt;code&amp;gt;C:\Program Files (x86)\OpenOffice\program\python.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;C:\Program Files (x86)\LibreOffice\program\python.exe&amp;lt;/code&amp;gt;.&lt;br /&gt;
Identify in the path whichever program you use and include the full exe name for both Ghostscript and Python.&lt;br /&gt;
 &lt;br /&gt;
Save the pathto statements and a green tick should appear if Moodle is communicating with the required files. &lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Document converters&#039;&#039; and enable &#039;&#039;&#039;Unoconv&#039;&#039;&#039; then select &#039;&#039;Settings&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the path statement to &lt;br /&gt;
&#039;&#039;Path to unoconv document converter&#039;&#039;: &amp;lt;code&amp;gt;C:\Program Files (x86)\unoconv\unoconv.bat&amp;lt;/code&amp;gt;.&lt;br /&gt;
Include the full name of the .bat file. &lt;br /&gt;
&lt;br /&gt;
Test ghostscript and unoconv are working correctly in the admin test pages &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Assignment &amp;gt; Feedback plugins &amp;gt; Annotate PDF&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Run a unoconv listener ==&lt;br /&gt;
Unoconv utilises a client/server process when converting documents. By default, when there is no running server process - each time unoconv runs it will start a server process, send its request and shut down the server process when the request is complete. The drawback of this mode is that if 2 requests are submitted simultaneously - this can cause the first request to shutdown the server process when the second request is still in progress - and the second conversion request fails. A more robust way to configure unoconv is to start a server process at boot time, and/or run a script to monitor it and restart it if it crashes.&lt;br /&gt;
&lt;br /&gt;
To start a unoconv listener at boot time - you need a start up script. Different operating systems and Linux distributions use different startup scripts - but here are some examples of startup scripts for different systems.&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/upstart | Upstart script for Ubuntu based systems]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/launchd | Launchd script for OS X]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/initd | Init script for Debian]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/initdcentos6 | Init script for CentOS/RedHat 6.x]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/systemd | SystemD service script for CentOS/RedHat 7.x]]&lt;br /&gt;
&lt;br /&gt;
== Offload processing to a different server ==&lt;br /&gt;
Processing office documents can put increased load on your webserver, which may impact on the responsiveness of your site. If you are installing unoconv on a large site you may want to consider running unoconv on a server that is not also serving web requests.&lt;br /&gt;
&lt;br /&gt;
How to do this:&lt;br /&gt;
&lt;br /&gt;
Install unoconv on each webservers and the remote server following the installation instructions above. &lt;br /&gt;
&lt;br /&gt;
Make sure unoconv is started at boot time on the remote server with the &amp;quot;--listener&amp;quot; argument and is monitored and restarted if it exits (see Debian init script for an example of how to do this). By default, unoconv will only listen on localhost (127.0.0.1): if you want to connect to the listener process from another server, you need to start the unoconv listener process with the &amp;quot;--server&amp;quot; argument too!&lt;br /&gt;
&lt;br /&gt;
An example command for starting a listener on a remote server (0.0.0.0 listens on all interfaces):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unoconv --listener --server 0.0.0.0 --port 2002&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the firewall port 2002 between the moodle webservers and the machine running unoconv.&lt;br /&gt;
&lt;br /&gt;
Share the moodle data root between the webservers and the machine running unoconv. This folder must be mounted at the same path on all servers. &lt;br /&gt;
&lt;br /&gt;
Install a wrapper for unoconv on the webservers that forwards the requests to the remote server. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Wrapper script for unoconv to forward processing.&lt;br /&gt;
# Install to /usr/bin/unoconv-remote with 755 permissions&lt;br /&gt;
/usr/bin/unoconv --server=&amp;lt;ip of remote server&amp;gt; &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the path to unoconv in the Moodle admin settings to point to this wrapper script.&lt;br /&gt;
&lt;br /&gt;
==Additional resources==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/dagwieers/unoconv GitHub dagwieers/unoconv] has additional information on installation of unoconv and troubleshooting tips.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
* [http://webnetkit.com/soffice-bin-using-100-cpu-moodle/ soffice.bin using 100% of CPU MOODLE]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=335310 Is the unoconv installation a security risk?] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
[[Category:Assignment]]&lt;br /&gt;
&lt;br /&gt;
[[es:Universal Office Converter (unoconv)]]&lt;br /&gt;
[[de:Universal Office Konverter]]&lt;br /&gt;
[[fr:Universal Office Converter]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Nginx&amp;diff=141611</id>
		<title>Nginx</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Nginx&amp;diff=141611"/>
		<updated>2021-08-31T12:15:20Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Undo revision 141607 by Matmercer (talk) I think previous revision is incorrect, details in https://moodle.org/mod/forum/discuss.php?d=413492#p1716224&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}[[Nginx]] [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavours. It also has a proof of concept port for Microsoft Windows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The following is community-contributed documentation on Nginx configuration. Amendments and additions are welcome.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Nginx configuration ==&lt;br /&gt;
&lt;br /&gt;
=== PHP-FPM ===&lt;br /&gt;
&lt;br /&gt;
Nginx is usually configured to interface with PHP via [http://php.net/manual/en/install.fpm.php php-fpm]. This is both fast and robust.&lt;br /&gt;
&lt;br /&gt;
PHP-FPM&#039;s default behaviour for pools is usually to restrict the execution of scripts to a specific extension, i.e. .php. You should ensure that this behaviour is configured within your particular package/distribution, e.g. for debian,&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/php5/fpm/pool.d/www.conf&#039;&#039;&#039;&lt;br /&gt;
 security.limit_extensions = .php&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the following &#039;slash arguments&#039; compatible &#039;location&#039; block to your vhosts &#039;server&#039; in your nginx configuration (further explanation at &#039;[[Using slash arguments]]&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;nginx.conf location:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location ~ [^/]\.php(/|$) {&lt;br /&gt;
    fastcgi_split_path_info  ^(.+\.php)(/.+)$;&lt;br /&gt;
    fastcgi_index            index.php;&lt;br /&gt;
    fastcgi_pass             127.0.0.1:9000 (or your php-fpm socket);&lt;br /&gt;
    include                  fastcgi_params;&lt;br /&gt;
    fastcgi_param   PATH_INFO       $fastcgi_path_info;&lt;br /&gt;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above does not work try the following:&lt;br /&gt;
Note: This was for CentOS 7.6 (1804), MariaDB 10.3, Nginx 1.15 and PHP 7.3.5&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location ~ ^(.+\.php)(.*)$ {&lt;br /&gt;
    root /usr/share/nginx/html/moodle/;&lt;br /&gt;
    fastcgi_split_path_info  ^(.+\.php)(.*)$;&lt;br /&gt;
    fastcgi_index            index.php;&lt;br /&gt;
    fastcgi_pass             127.0.0.1:9000;&lt;br /&gt;
    include /etc/nginx/mime.types;&lt;br /&gt;
    include                  fastcgi_params;&lt;br /&gt;
    fastcgi_param   PATH_INFO       $fastcgi_path_info;&lt;br /&gt;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you find that this does not work (scripts, styles, and images not loading) &#039;&#039;&#039;and&#039;&#039;&#039; that there are &amp;lt;code&amp;gt;open() &amp;quot;...&amp;quot; failed (20: Not a directory)&amp;lt;/code&amp;gt; lines appearing in your logs: Check whether there are any directives related to static content &#039;&#039;&#039;before&#039;&#039;&#039; this block and try moving them &#039;&#039;&#039;after&#039;&#039;&#039; this block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another potential pitfall is the use of &#039;&#039;&#039;try_files&#039;&#039;&#039;. Many guides recommend configurations like &amp;lt;pre&amp;gt;try_files $fastcgi_script_name =404;&amp;lt;/pre&amp;gt;. But if try_files is used, nginx deletes the content of the &#039;&#039;&#039;$fastcgi_path_info&#039;&#039;&#039; variable (this is [https://trac.nginx.org/nginx/ticket/321 intended behavior]). This causes &#039;&#039;&#039;PATH_INFO&#039;&#039;&#039; to also be empty, so slash arguments don&#039;t work.&lt;br /&gt;
An alternative is the use of &amp;lt;pre&amp;gt;if(!-f $document_root$fastcgi_script_name) {return 404;}&amp;lt;/pre&amp;gt; [https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm as recommended] by the nginx documentation, although the nginx documentation also recommends [https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ not using if].&lt;br /&gt;
&lt;br /&gt;
==== Error pages ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This passes 404 pages to Moodle so they can be themed&lt;br /&gt;
error_page 404 /error/index.php;    error_page 403 =404 /error/index.php;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Hiding internal files ====&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Hide all dot files but allow &amp;quot;Well-Known URIs&amp;quot; as per RFC 5785&lt;br /&gt;
location ~ /\.(?!well-known).* {&lt;br /&gt;
    return 404;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
# This should be after the php fpm rule and very close to the last nginx ruleset.&lt;br /&gt;
# Don&#039;t allow direct access to various internal files. See MDL-69333&lt;br /&gt;
location ~ (/vendor/|/node_modules/|composer\.json|/readme|/README|readme\.txt|/upgrade\.txt|db/install\.xml|/fixtures/|/behat/|phpunit\.xml|\.lock|environment\.xml) {&lt;br /&gt;
    deny all;&lt;br /&gt;
    return 404;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== XSendfile aka X-Accel-Redirect ====&lt;br /&gt;
&lt;br /&gt;
Setting Moodle and Nginx to use XSendfile functionality is a big win as it frees PHP from delivering files allowing Nginx to do what it does best, i.e. deliver files. &lt;br /&gt;
&lt;br /&gt;
Enable xsendfile for Nginx in Moodles config.php, this is documented in the config-dist.php, a minimal configuration look like this,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;xsendfile = &#039;X-Accel-Redirect&#039;;&lt;br /&gt;
$CFG-&amp;gt;xsendfilealiases = array(&lt;br /&gt;
    &#039;/dataroot/&#039; =&amp;gt; $CFG-&amp;gt;dataroot&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Accompany this with a matching &#039;location&#039; block in your nginx server configuration.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location /dataroot/ {&lt;br /&gt;
    internal;&lt;br /&gt;
    alias &amp;amp;lt;full_moodledata_path&amp;amp;gt;; # ensure the path ends with /&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The definition of &#039;internal&#039; here is &#039;&#039;&#039;critical&#039;&#039;&#039; as it prevents client access to your dataroot.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Real &amp;lt;tt&amp;gt;PATH_INFO&amp;lt;/tt&amp;gt; support:&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=278916&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=307388&lt;br /&gt;
* &#039;&#039;&#039;[Deprecated]&#039;&#039;&#039; Internal rewriting to the HTTP GET &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; parameter:&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=83445&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Nginx]]&lt;br /&gt;
[[pt-br:Nginx]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=141572</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=LDAP_authentication&amp;diff=141572"/>
		<updated>2021-08-25T09:09:34Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* User lookup settings */ Updated &amp;#039;Member attribute uses dn&amp;#039; as this must be correctly set from 3.8.5/3.9.2 onward https://tracker.moodle.org/browse/MDL-70596#comment-871688&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
Moodle supports several types of LDAP servers which have different directory structures, special configuration settings, etc. Even if using the same LDAP server type (e.g., MS Active Directory), each site could use a completely different directory structure to hold its user accounts, groups, etc. In order to be able to show example configuration settings in the sections below, we are going to assume a &#039;&#039;&#039;hypothetical&#039;&#039;&#039; Moodle site and LDAP server with the characteristics listed below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT NOTICE&#039;&#039;&#039;: be sure to check &#039;&#039;&#039;&#039;&#039;your&#039;&#039;&#039;&#039;&#039; Moodle site and LDAP server details (including its directory structure,) and adjust the settings to reflect your own setup.&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
===Enabling LDAP authentication===&lt;br /&gt;
&lt;br /&gt;
An administrator can enable LDAP authentication as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; and click the eye icon opposite LDAP Server. When enabled, it will no longer be greyed out.&lt;br /&gt;
# Click the settings link, configure as required (see information below), then click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (Yes) or not (No). This must be set to Yes for Active Directory.&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the LDAP sync users task. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Novell eDirectory and MS-AD can create users externally. You can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Assign system roles====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| System role mapping&lt;br /&gt;
| This section lists all roles that have can be assigned in the System context - by default this will be &amp;quot;Manager context&amp;quot; and &amp;quot;Course creator context&amp;quot;, but can be customisable in the [[Creating custom roles|role definitions]].&lt;br /&gt;
&lt;br /&gt;
To assign LDAP users to any of the roles, specify the DN containing all users who should be granted that role at the system level.&lt;br /&gt;
&lt;br /&gt;
Thie DN is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
&lt;br /&gt;
This section replaces the &amp;quot;Course creator&amp;quot; section found in Moodle 3.3. The upgrade process should migrate any DN specified to the new approach.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====User account synchronisation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usually &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usually &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usually &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usually &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Enabling the LDAP users sync job==&lt;br /&gt;
&lt;br /&gt;
The LDAP users sync job (&#039;&#039;\auth_ldap\task\sync_task&#039;&#039;) [[Scheduled tasks|scheduled task]] (new in Moodle 3.0; previously there was a CLI script, see MDL-51824 for more info)  is responsible for creating and updating user information, and suspending and deleting LDAP accounts. &lt;br /&gt;
&lt;br /&gt;
After enabling LDAP server authentication, an administrator needs to enable and configure the LDAP users sync job as follows:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Server &amp;gt; Scheduled tasks&#039;&#039; and click the gear icon opposite LDAP users sync job.&lt;br /&gt;
# Select the desired frequency of running and enable the task by un-ticking the disabled checkbox.&lt;br /&gt;
{{Warning|It is important to make sure that all LDAP settings are working properly before enabling the LDAP users sync job (as well as backing up your database and moodledata folders), since incorrect LDAP configuration can result in users being wrongly deleted!}}&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher than Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions in http://support.microsoft.com/kb/315071 to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain] forum discussion&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more than one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning always the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Any questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?id=42 Authentication forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Cron&amp;diff=141569</id>
		<title>Cron</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Cron&amp;diff=141569"/>
		<updated>2021-08-24T16:37:45Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: /* Scaling up cron with multiple processes */ Tidied formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
The Moodle &#039;cron&#039; process is a PHP script (part of the standard Moodle installation) that must be run regularly in the background. The Moodle cron script runs different tasks at differently scheduled intervals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT: Do not skip setting up the cron process on your server for your Moodle. Your site will not work properly without it.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is recommended that &#039;&#039;the cron is run every minute&#039;&#039;, as required for asynchronous activity deletion when using the [[Recycle bin|recycle bin]].&lt;br /&gt;
&lt;br /&gt;
The cron program (that runs the Moodle script) is a core part of Unix based systems (including Linux and OSX) being used to run all manner of time-dependent services. On Windows the simplest solution is to create a task in the Windows Task Scheduler and set it to run at regular intervals. On shared hosting, you should find the documentation (or ask support) how cron is configured. Most shared hosting systems use CPanel to manage sites, and usually will have a section for Cron Jobs on the panel.&lt;br /&gt;
&lt;br /&gt;
Essentially, the task involves adding a single command to the list of cron activities on your system. On Unix based systems this list is a file called a &#039;crontab&#039; which all users have. &lt;br /&gt;
== General discussion ==&lt;br /&gt;
See the later sections for your server type; this section contains some general background information. &lt;br /&gt;
&lt;br /&gt;
There are essentially two steps to implementing cron:&lt;br /&gt;
# identifying the correct command to run&lt;br /&gt;
# finding the right place on your system to put the command&lt;br /&gt;
=== Working out the Moodle cron command ===&lt;br /&gt;
Moodle has two different ways to deploy cron which use different scripts within the Moodle install. These are as follows...&lt;br /&gt;
# The CLI (command line interpreter) script. This will be at the path &amp;lt;pre&amp;gt;/path/to/moodle/admin/cli/cron.php&amp;lt;/pre&amp;gt; If in doubt, this is the correct script to use. This needs to be run by a &#039;PHP CLI&#039; program on your computer. So the final command may look something like &amp;lt;pre&amp;gt;/usr/bin/php /path/to/moodle/admin/cli/cron.php&amp;lt;/pre&amp;gt; You can (and should) try this on your command line to see if it works. &#039;&#039;&#039;WARNING: Check your command-line PHP version is compatible with your chosen version of Moodle. The command-line PHP program is different to the one running your web site and is not always the same version.&#039;&#039;&#039;&lt;br /&gt;
# If, for some reason, you cannot run the CLI script there is the web based script. Note that this is now deprecated and may be removed in future versions. This needs to be run from a web browser and will be accessed via a web url something like &#039;&#039;&#039;http://your.moodle.site/admin/cron.php&#039;&#039;&#039;. You can find command line based web browser (e.g. wget) so the final command may look like &amp;lt;pre&amp;gt;/usr/bin/wget http://your.moodle.site/admin/cron.php&amp;lt;/pre&amp;gt; This has the advantage that it can be run from *anywhere*. If you can&#039;t get cron to work on your machine it can be run somewhere else.&lt;br /&gt;
===The web based Moodle cron command===&lt;br /&gt;
* If you have a choice, do not use the web based cron. It is likely to be removed in a future Moodle version. &lt;br /&gt;
* From Moodle 2.9 onwards, the cron job can no longer be run from web by default. You will get an error message:&lt;br /&gt;
 !!! Sorry, internet access to this page has been disabled by the administrator. !!! &lt;br /&gt;
* You can change this in &#039; Dashboard ► Site administration ► Security ► Site policies &#039; by deselecting &#039;Cron execution via command line only&#039;.&lt;br /&gt;
** You will be warned that &#039;Running the cron from a web browser can expose privileged information to anonymous users. Thus it is recommended to only run the cron from the command line or set a cron password for remote access.&#039;&lt;br /&gt;
** You can then write a &#039;Cron password for remote access&#039;. If this field is left empty, no password is required.&lt;br /&gt;
** This means that the cron.php script cannot be run from a web browser without supplying the password using the following form of URL:&lt;br /&gt;
  http://site.example.com/admin/cron.php?password=opensesame&lt;br /&gt;
=== Finding the right place to put the command ===&lt;br /&gt;
This really does depend on the system you are using and you should find and read the documentation for your platform or hosting. In most cases getting the Moodle cron to run consists of establishing the correct command (above) and then adding it, and the time to run the command, to some sort of file. This might be either through a specific user interface or by editing the file directly.&lt;br /&gt;
&lt;br /&gt;
If using the CLI version you also need to make sure that the cron process is run as the correct user. This is not an issue with the web version. &lt;br /&gt;
&lt;br /&gt;
Example... installing cron on Ubuntu/Debian Linux. Assuming logged in as root..&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;use the crontab command to open a crontab editor window for the www-data user. This is the user that Apache (the web server) runs as on Debian based systems&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ crontab -u www-data -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;This will open an editor window. To run the cli cron script every 1 minute, add the line:&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php &amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
NOTE: the final &#039;&#039;&#039;&amp;gt;/dev/null&#039;&#039;&#039; sends all the output to the &#039;bin&#039; and stops you getting an email every 1 minute.&lt;br /&gt;
== Setting up cron on your system ==&lt;br /&gt;
Choose the information for your server type:&lt;br /&gt;
*[[Cron with Unix or Linux]]- Cron services on various UNIX and Linux flavored operating systems.&lt;br /&gt;
*[[Cron with Windows OS]] - Cron services in Windows&lt;br /&gt;
*&#039;&#039;Apple OSX&#039;&#039; - use the built-in &#039;crontab&#039; service which is exactly the same as [[Cron with Unix or Linux]]. However, you might want to do it the &#039;Apple way&#039; using launchd - see [[Cron with MAC OS X]]&lt;br /&gt;
*[[Cron with web hosting services]]- Cron services in various web hosting examples.&lt;br /&gt;
Here are some more instructions for specific hosts (please check that these are up to date):&lt;br /&gt;
*[[Cron on 1and1 shared servers]]&lt;br /&gt;
== Using third party cron service ==&lt;br /&gt;
Besides using cron hosted on your own server, you may use third party cron service (usually called webcron):&lt;br /&gt;
*[https://cron-job.org/ cron-job.org] is a free service. (1Minute cron is possible)&lt;br /&gt;
&lt;br /&gt;
*[https://www.easycron.com EasyCron] - A webcron service provider that eliminates the need of crontab or other task schedulers to set cron job.&lt;br /&gt;
&lt;br /&gt;
*[https://webcron.talent-factory.ch/ WebCron] - A free and easy webcron service provider.&lt;br /&gt;
=== Cron settings in Moodle ===&lt;br /&gt;
An admin can set cron execution via command line only or a cron password for remote access in &#039;Site security settings&#039; in the Site administration.&lt;br /&gt;
===Remote cron===&lt;br /&gt;
Using the &#039;web based&#039; version of cron it is perfectly ok to place the cron process on a different machine to the Moodle server. For example, the cron service on a Unix server can invoke the cron web &#039;page&#039; on a Windows based Moodle server.&lt;br /&gt;
==Scheduling tasks==&lt;br /&gt;
An administrator can schedule cron tasks very precisely from Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; Scheduled tasks, see [[Scheduled tasks]]&lt;br /&gt;
==Running cron for several Moodle servers==&lt;br /&gt;
* Tasks can run in parallel and processes use locking to prevent tasks from running at the same time which allows cron to be triggered from multiple web servers that serve the same Moodle instance.&lt;br /&gt;
&lt;br /&gt;
* If you are running different Moodle instances on the same server, then each Moodle instance needs a cron job. (Even a single Apache web server can run different Moodle instances on different domains by using its virtual hosts capability [https://httpd.apache.org/docs/2.2/vhosts/index.html https://httpd.apache.org/docs/2.2/vhosts/index.html].)&lt;br /&gt;
== Debugging Scheduled Tasks ==&lt;br /&gt;
Sometimes, a particular cron task may not be working correctly. In Moodle versions before 2.7 - any cron task that was throwing exceptions would prevent the rest of cron from running. The only way to monitor if cron was completing each time, was to add some automated checking of the output of running cron (e.g. searching for the string &amp;quot;Cron completed at &amp;quot;).&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.7 and later, a single failing scheduled task will not prevent the remaining tasks from completing. When any single scheduled task fails, it is marked as a failure, and scheduled to be reattempted. If the task keeps failing, the next scheduled time will be backed off until it is attempted at most once every 24 hours. But checking the [[Scheduled tasks]] admin page, you can see if any task is currently failing (it will have a non-zero fail delay - which is the number of seconds to wait before reattempting a failed task). A simple way to debug a failing task, is to run it immediately using the [[Administration via command line#Scheduled_tasks|cli scheduled task runner]] and monitor the output.&lt;br /&gt;
== Logging and monitoring ==&lt;br /&gt;
Ideally you should also be logging the output of cron somewhere and monitoring it for issues. You can monitor the overall status of cron to make sure there are no errors by visiting:&lt;br /&gt;
&lt;br /&gt;
Site administration / Reports / System status (/report/status/index.php)&lt;br /&gt;
&lt;br /&gt;
You can also wire this status report up to tools like Icinga / Nagios using the Check API (https://docs.moodle.org/dev/Check_API) cli commands or with the help of plugins like https://github.com/catalyst/moodle-tool_heartbeat.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sh&amp;gt;&lt;br /&gt;
/admin/cli/checks.php&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are errors then you can get more details for recently run tasks from the Logs column on the Scheduled task page, but this won&#039;t show ad hoc task failures:&lt;br /&gt;
&lt;br /&gt;
Site administration / Server / Tasks / Scheduled tasks (/admin/tool/task/scheduledtasks.php)&lt;br /&gt;
&lt;br /&gt;
To see ad hoc task failures you either need to rerun the task manually yourself and see the errors, or you need to have already collected the logs for review. For a Moodle running on a single box you could log to a simple log file, or for a cluster you might want to use syslogd or similar, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php 2&amp;gt;&amp;amp;1 | /usr/bin/logger ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Low latency adhoc tasks ==&lt;br /&gt;
Each time cron is run, after the scheduled tasks the ad hoc tasks are also run. While scheduled tasks can run at most once a minute, ad hoc tasks can be queued at any moment, and generally you want them processed as soon as possible and to not have to wait for the scheduled task to run first. If you only run the normal admin/cli/cron.php then not only might it have to wait to process all the scheduled tasks first, if it has already finished you will have to wait until the next minute for cron to start again for it to be processed.&lt;br /&gt;
&lt;br /&gt;
Instead you can run one or more dedicated ad hoc task processors which run in parallel to the main cron process.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/adhoc_task.php --execute --keep-alive=59&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/adhoc_task.php --execute --keep-alive=59&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Starting from Moodle 3.9 the—keep-alive option runs like a daemon so when the queue is empty rather than exiting it waits for new tasks to be queued so it can start processing as soon as possible.&lt;br /&gt;
== Scaling up cron with multiple processes ==&lt;br /&gt;
As your site grows many of the scheduled tasks will take longer to complete, and also there will be more ad hoc tasks queued which need to be processed. The cron system is designed to work in parallel but each individual process can only process one task at a time so you must run multiple cron cli&#039;s. You can generally run a fairly high number of cron processes on a dedicated cron instance before needing to run multiple cron instances. To run more than one process simply spawn multiple cron processes each minute:&lt;br /&gt;
&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
 ⋮&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/adhoc_task.php --execute --keep-alive=59&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/adhoc_task.php --execute --keep-alive=59&lt;br /&gt;
 * * * * * /usr/bin/php  /path/to/moodle/admin/cli/adhoc_task.php --execute --keep-alive=59&lt;br /&gt;
 ⋮&lt;br /&gt;
&lt;br /&gt;
It can be especially important to increase the number of adhoc_task.php processes as certain plugins and systems can generate very large numbers of ad hoc tasks, or tasks that can take a long time to process. Especially tasks like document conversions and automated backups can build up more quickly than they are processed if they are left on default settings.&lt;br /&gt;
&lt;br /&gt;
By default only 3 scheduled tasks and 3 ad hoc tasks can be run concurrently so as you add more processes you need to increase the level of allowed concurrency:&lt;br /&gt;
&lt;br /&gt;
Site administration &amp;gt; Server &amp;gt; Tasks &amp;gt; Task processing&lt;br /&gt;
&lt;br /&gt;
Or in &amp;lt;code&amp;gt;config.php&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;task_scheduled_concurrency_limit = 20; // Defaults to 3&lt;br /&gt;
$CFG-&amp;gt;task_adhoc_concurrency_limit = 50; // Defaults to 3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whatever you set these to make sure the server(s) hosting them can comfortably handle this many processes. Often the bottleneck will be a shared service, usually the database.&lt;br /&gt;
&lt;br /&gt;
You may find that certain types of very long running tasks will consume all the available task processes which means no other tasks will run. e.g. if you have 5 cli processes, but in the task queue there are 20 ad hoc tasks for an automated backup, each of which will take ten minutes to complete, then very quickly all 5 processes will be consumed by backups and nothing else. Other small very fast and light tasks like a document conversion or forum emails will not get sent until the backups are complete and a process frees up. To manage this you can limit the concurrency of specific types of ad hoc tasks. A good rule of thumb is that if all of the &#039;heavy&#039; tasks consume all of their own limits then you should still have another few processes standing by on idle waiting for anything else which may be added to the queue.&lt;br /&gt;
&lt;br /&gt;
Automated backups are the worst known offender, so hypothetically if you are running 50 ad hoc task processes concurrently a reasonable restriction might be to cap the backups to consume no more than half of those processes, ie 25 at most:&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;config.php&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;task_concurrency_limit = [&lt;br /&gt;
    &#039;core\task\course_backup_task&#039; =&amp;gt; 25,&lt;br /&gt;
    &#039;core_course\task\course_delete_modules&#039; =&amp;gt; 5,&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Scheduled tasks]]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Cron Wikipedia article on cron function]&lt;br /&gt;
* MDL-50694 - Cron message &amp;quot;The operation timed out while waiting for a lock&amp;quot; isn&#039;t really an error&lt;br /&gt;
Forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=139263#p609060 How to log the output of a Scheduled Task on Windows] - this discussion explains a nice trick that can be very useful when you are experiencing problems with your Windows Scheduled Task and you need to log the output of the Scheduled Task to a log file.&lt;br /&gt;
[[es:Cron]]&lt;br /&gt;
[[fr:Cron]]&lt;br /&gt;
[[ja:Cron]]&lt;br /&gt;
[[de:Cron-Job]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/402/en/index.php?title=Report_builder&amp;diff=141564</id>
		<title>Report builder</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/402/en/index.php?title=Report_builder&amp;diff=141564"/>
		<updated>2021-08-23T10:41:54Z</updated>

		<summary type="html">&lt;p&gt;Leonstr: Changed &amp;lt;code&amp;gt; to &amp;lt;syntaxhighlight&amp;gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Workplace}}&lt;br /&gt;
= Overview =&lt;br /&gt;
Moodle Workplace provides a graphical custom reporting tool. Moodle Workplace custom reports are built using the report builder interface, which provides advanced customization options to administrators. System reports are used in every listing in Workplace: Dashboard, [[Programs]], [[Certifications]], [[Dynamic rules]], and even in the Report builder itself. &lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/gvQ6WqFYGns | desc = Moodle Workplace | Training | Report Builder}}&lt;br /&gt;
&lt;br /&gt;
= Accessing the report builder =&lt;br /&gt;
The report builder can be made available to all users, and is accessed from the Workplace launcher. For instructions on granting access to a report, see the [[#Configuring_audience|configuring audience]] section below.&lt;br /&gt;
&lt;br /&gt;
= Creating a custom report =&lt;br /&gt;
To create a new custom report, the administrator clicks the plus icon on the reports tab. Reports can use any data from their data sources, including data from the Workplace Datastore that contains historical information and snapshots of past events. &lt;br /&gt;
&lt;br /&gt;
[[File:wp-rb-new-report.png]]&lt;br /&gt;
&lt;br /&gt;
After selecting a data source for the new report, we can click on a column or drag it into the table to add it to the report. To use aggregation on any column, we just need to click on the &amp;quot;Select an aggregation for the column&amp;quot; icon and then we can select the kind of aggregation depending on the column data type.&lt;br /&gt;
&lt;br /&gt;
== Limiting number of custom reports ==&lt;br /&gt;
A site administrator can restrict the number of custom reports that can be created per site/tenant by adding the following line(s) to the [[Configuration_file|site configuration]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;tool_reportbuilder_limitsenabled = true;&lt;br /&gt;
$CFG-&amp;gt;tool_reportbuilder_sitelimit = &amp;lt;VALUE&amp;gt;;&lt;br /&gt;
$CFG-&amp;gt;tool_reportbuilder_tenantlimit = &amp;lt;VALUE&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Omitting this configuration, or setting &amp;lt;tt&amp;gt;$CFG-&amp;gt;tool_reportbuilder_limitsenabled = false;&amp;lt;/tt&amp;gt; indicates that no limit should be applied to the number of custom reports that can be created. Enabling limits and setting the values to 0 will disable the creation of custom reports. Note that a tenant limit cannot exceed a site limit.&lt;br /&gt;
&lt;br /&gt;
== Disabling live editing in reports ==&lt;br /&gt;
For performance reasons a site administrator may consider disabling live editing of reports, that being the constant updating of report data while editing report content (columns, filters, conditions) by adding the following to the [[Configuration_file|site configuration]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;tool_reportbuilder_liveediting = false;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Omitting this configuration, or setting &amp;lt;tt&amp;gt;$CFG-&amp;gt;tool_reportbuilder_liveediting = true;&amp;lt;/tt&amp;gt; indicates that live editing is enabled.&lt;br /&gt;
&lt;br /&gt;
= Conditions and Filters =&lt;br /&gt;
Clicking in the &amp;quot;Show/hide filters sidebar&amp;quot; icon on the right will expand the right panel that we can use to define conditions and filters and set the default sorting order. Using conditions, we can pre-filter the report for the users. Conditions cannot be changed in the viewing mode. In the filters tab, we can define filters and we can define the default sorting order using the last tab just by selecting and rearranging the available options. &lt;br /&gt;
&lt;br /&gt;
[[File:wp-rb-conditions.png]]&lt;br /&gt;
&lt;br /&gt;
= Preview report =&lt;br /&gt;
Finally the report can be previewed by clicking the &amp;quot;Switch to preview view&amp;quot; icon, and it displays as it would for the person viewing the report, including any conditions defined. Filters can be reset using the icon on each filter or all at once.&lt;br /&gt;
&lt;br /&gt;
[[File:wp-rb-preview.png]]&lt;br /&gt;
&lt;br /&gt;
= Configuring audience =&lt;br /&gt;
Any person with the capability to manage or view reports can view all custom reports defined in their tenant. It is possible to specify additional audiences of the report that will grant access to the reports to users within them. To specify which user audiences should be able to access a given report, navigate to the &amp;quot;Audience&amp;quot; tab when editing it. You can add as many audiences to the report as necessary. Currently supported types are as follows:&lt;br /&gt;
&lt;br /&gt;
* [[Organisation_structure#Assigning_jobs|Organisation job assignments]]&lt;br /&gt;
* Users [[Assign_roles#System_context|assigned system roles]]&lt;br /&gt;
* [[Cohorts|Cohort]] members&lt;br /&gt;
* Manually selected users&lt;br /&gt;
&lt;br /&gt;
To confirm which users now have access to the report, switch to the &amp;quot;Access&amp;quot; tab.&lt;br /&gt;
&lt;br /&gt;
In addition to granting user access to reports, it is also possible to specify which users should be listed in any given report. To achieve this the &amp;quot;[[Report_builder_(Audience)|Relation to the report viewer]]&amp;quot; condition should be added to the report.&lt;br /&gt;
&lt;br /&gt;
[[File:Report Builder Audiences.png]]&lt;br /&gt;
&lt;br /&gt;
= Sending report results =&lt;br /&gt;
Custom reports can be created and scheduled to be sent out to specific audiences. From the manage custom reports page, navigate to the schedules tab of a report. Here, the administrator clicks the &amp;quot;New schedule&amp;quot; button and selects which report they would like to be sent. Various report formats are available to use for attached report data (CSV, Excel Spreadsheet, HTML, JSON, ODS, PDF), as well as recurrence options (send every weekday, month, etc). The administrator can also select which user should be used when sending the scheduled report. This allows the report to be sent to the audience as if it were being viewed by that user.&lt;br /&gt;
&lt;br /&gt;
The recipients options allow the administrator to select which users should receive the report. All defined audiences for the current report are listed here for selection.&lt;br /&gt;
&lt;br /&gt;
Finally, the message subject and content can be configured.&lt;br /&gt;
&lt;br /&gt;
[[File:Report Builder Schedules.png]]&lt;br /&gt;
&lt;br /&gt;
= Upgrading audience and schedules prior to 3.11  =&lt;br /&gt;
&amp;lt;p&amp;gt;[https://docs.moodle.org/dev/Moodle_Workplace_3.11_release_notes#3.11 Moodle Workplace 3.11] introduced some changes in the audience and schedules for Report Builder to support more types of audiences and link schedules to existing audiences.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Due to these improvements, audiences and schedules from versions prior to 3.11 need to be upgraded following this process:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;Audiences&amp;lt;/strong&amp;gt;: report audiences based on job department/position will be converted to the new &amp;quot;job&amp;quot; audience type.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;Schedules&amp;lt;/strong&amp;gt;: New audiences will be automatically created for previously defined report schedule recipients for job department, position and manually added users. Each of these audiences will automatically be added to the new schedule as recipients.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Note &amp;lt;strong&amp;gt;recipient emails are no longer supported in schedules&amp;lt;/strong&amp;gt;. Where previous schedules used these, the person who created the schedule will receive an email notifying them of any changes made. The email will include a list of previous email recipients, with a link to this page. As an alternative to external email addresses, consider creating users with the [[No_login|No login]] authentication method.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The same process will be followed when [[Migrations#Report_Builder_audience_and_schedules_prior_to_3.11|importing Report Builder audience and schedules prior to 3.11 using the Migration tool]].&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Shared reports =&lt;br /&gt;
After enabling [[Multi-tenancy#Shared_Space|Shared space]], users can create shared reports inside of it. These shared reports will be listed in the custom reports page in all tenants and will be marked with a &amp;quot;Shared space&amp;quot; label next to it.&lt;br /&gt;
&lt;br /&gt;
This feature enables users to use the same report definition site-wide without duplicating the same reports in all tenants. It also allows to create cross-tenant reports. When a shared report is viewed from inside the tenant it only displays the users and entities from this tenant. When a shared report is viewed from Shared space it shows information from all tenants.&lt;br /&gt;
&lt;br /&gt;
[[File:Shared reports - 02.png]]&lt;br /&gt;
&lt;br /&gt;
Reports in the shared space can be shared with all tenants or be only accessible to users with access to the shared space.&lt;br /&gt;
&lt;br /&gt;
== Creating a new shared report ==&lt;br /&gt;
Access the Shared space from the tenant switch dropdown, in the navigation bar. When inside the Shared space go to Report Builder in the Workplace launcher and create a new report as usual.&lt;br /&gt;
&lt;br /&gt;
There&#039;s a setting to effectively share the report to make it available in other tenants. If this is not set, the report will be available only in the shared space (see the screenshot below).&lt;br /&gt;
&lt;br /&gt;
[[File:Shared reports - 01.png]]&lt;/div&gt;</summary>
		<author><name>Leonstr</name></author>
	</entry>
</feed>