<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wmasterj</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wmasterj"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/Special:Contributions/Wmasterj"/>
	<updated>2026-04-16T17:19:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82724</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82724"/>
		<updated>2011-04-12T07:18:49Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Authentication API&#039;&#039;&#039; describes Moodle&#039;s interface functions to authentication plugins. &lt;br /&gt;
(This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of the functions are from the [[LDAP_authentication|ldap-authentication module]] and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_user_login ($username, $password)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
;Returns:true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
The following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_get_userinfo($username)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
;Returns:User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if  &amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt; is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_iscreator($username)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_user_exists ($username)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_user_create ($userobject,$plainpass)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_user_activate ($username)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_user_disable ($username)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_get_userlist ()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
;Returns:All usernames in array or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;auth_get_users($filter=&#039;*&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
;Returns:Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82723</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82723"/>
		<updated>2011-04-12T07:15:45Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Authentication API&#039;&#039;&#039; describes Moodle&#039;s interface functions to authentication plugins. &lt;br /&gt;
(This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of the functions are from the [[LDAP_authentication|ldap-authentication module]] and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
;Returns:true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
The following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
;Returns:User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if  &amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt; is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
;Returns:&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on success otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
;Returns:All usernames in array or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
;Returns:Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82722</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82722"/>
		<updated>2011-04-12T07:06:05Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Authentication API&#039;&#039;&#039; describes Moodle&#039;s interface functions to authentication plugins. &lt;br /&gt;
(This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of the functions are from the [[LDAP_authentication|ldap-authentication module]] and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
Returns: true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
The following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
Returns: User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if  &amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt; is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
Returns: True if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
Returns: true if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: All usernames in array or false on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
Returns: Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82721</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82721"/>
		<updated>2011-04-12T07:02:38Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;Authentication API&#039;&#039;&#039; describes Moodle&#039;s interface functions to authentication plugins. &lt;br /&gt;
(This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of functions are from ldap-authentication module and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
Returns: true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
Following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
&lt;br /&gt;
User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if&lt;br /&gt;
&amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt;&lt;br /&gt;
is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
Returns: True if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
Returns: true if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: All usernames in array or false on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
Returns: Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82720</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82720"/>
		<updated>2011-04-12T07:01:11Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Moodle authentication interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Moodle authentication interface==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Authentication API&#039;&#039;&#039; describes Moodle interface functions to authentication modules. (This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of functions are from ldap-authentication module and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
Returns: true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
Following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
&lt;br /&gt;
User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if&lt;br /&gt;
&amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt;&lt;br /&gt;
is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
Returns: True if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
Returns: true if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: All usernames in array or false on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
Returns: Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82719</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82719"/>
		<updated>2011-04-12T07:00:20Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Moodle authentication interface==&lt;br /&gt;
&lt;br /&gt;
Authentication API This file describes Moodle interface functions to authentication modules. (This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of functions are from ldap-authentication module and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
Returns: true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
Following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
&lt;br /&gt;
User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if&lt;br /&gt;
&amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt;&lt;br /&gt;
is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
Returns: True if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
Returns: true if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: All usernames in array or false on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
Returns: Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82717</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82717"/>
		<updated>2011-04-12T06:56:22Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Overview of Moodle authentication process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;code&amp;gt;$user&amp;lt;/code&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;code&amp;gt;$user&amp;lt;/code&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from &amp;lt;tt&amp;gt;mdl_user&amp;lt;/tt&amp;gt; if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the &amp;lt;tt&amp;gt;user_login()&amp;lt;/tt&amp;gt; function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its &amp;lt;tt&amp;gt;update_user_record()&amp;lt;/tt&amp;gt; function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s &amp;lt;tt&amp;gt;sync_roles()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s &amp;lt;tt&amp;gt;user_authenticated_hook()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory &amp;lt;tt&amp;gt;/auth/sentry&amp;lt;/tt&amp;gt;.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file &amp;lt;tt&amp;gt;/auth/sentry/auth.php&amp;lt;/tt&amp;gt;.  Within the file, create a class &amp;lt;tt&amp;gt;auth_plugin_sentry&amp;lt;/tt&amp;gt; that extends &amp;lt;tt&amp;gt;auth_plugin_base&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;/lib/authlib.php&amp;lt;/tt&amp;gt;.  (You will need to &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; the authlib file.)&lt;br /&gt;
# Implement the &amp;lt;tt&amp;gt;user_login()&amp;lt;/tt&amp;gt; function in your &amp;lt;tt&amp;gt;auth.php&amp;lt;/tt&amp;gt; file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory &amp;lt;tt&amp;gt;/auth/sentry/lang&amp;lt;/tt&amp;gt;, and under it, a directory for each language that your installation needs to support.  (Example: &amp;lt;tt&amp;gt;/auth/sentry/lang/en_us_utf8&amp;lt;/tt&amp;gt;.)  Within each of these language directories, create a file called &amp;lt;tt&amp;gt;auth_sentry.php&amp;lt;/tt&amp;gt;.  That file should set the desired value for &amp;lt;code&amp;gt;$string[&#039;auth_sentrytitle&#039;] for that language&amp;lt;/code&amp;gt;.  You can also set the plugin description by setting &amp;lt;code&amp;gt;$string[&#039;auth_sentrydescription&#039;]&amp;lt;/code&amp;gt;, and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language/locale codes used in your moodle installation. For example, the lang folder in own users system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. He emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement &amp;lt;tt&amp;gt;config_form()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;process_config()&amp;lt;/tt&amp;gt; in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the &amp;lt;tt&amp;gt;mdl_config_pluginstable&amp;lt;/tt&amp;gt; in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82716</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82716"/>
		<updated>2011-04-12T06:53:23Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from &amp;lt;tt&amp;gt;mdl_user&amp;lt;/tt&amp;gt; if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the &amp;lt;tt&amp;gt;user_login()&amp;lt;/tt&amp;gt; function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its &amp;lt;tt&amp;gt;update_user_record()&amp;lt;/tt&amp;gt; function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s &amp;lt;tt&amp;gt;sync_roles()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s &amp;lt;tt&amp;gt;user_authenticated_hook()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory &amp;lt;tt&amp;gt;/auth/sentry&amp;lt;/tt&amp;gt;.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file &amp;lt;tt&amp;gt;/auth/sentry/auth.php&amp;lt;/tt&amp;gt;.  Within the file, create a class &amp;lt;tt&amp;gt;auth_plugin_sentry&amp;lt;/tt&amp;gt; that extends &amp;lt;tt&amp;gt;auth_plugin_base&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;/lib/authlib.php&amp;lt;/tt&amp;gt;.  (You will need to &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; the authlib file.)&lt;br /&gt;
# Implement the &amp;lt;tt&amp;gt;user_login()&amp;lt;/tt&amp;gt; function in your &amp;lt;tt&amp;gt;auth.php&amp;lt;/tt&amp;gt; file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory &amp;lt;tt&amp;gt;/auth/sentry/lang&amp;lt;/tt&amp;gt;, and under it, a directory for each language that your installation needs to support.  (Example: &amp;lt;tt&amp;gt;/auth/sentry/lang/en_us_utf8&amp;lt;/tt&amp;gt;.)  Within each of these language directories, create a file called &amp;lt;tt&amp;gt;auth_sentry.php&amp;lt;/tt&amp;gt;.  That file should set the desired value for &amp;lt;code&amp;gt;$string[&#039;auth_sentrytitle&#039;] for that language&amp;lt;/code&amp;gt;.  You can also set the plugin description by setting &amp;lt;code&amp;gt;$string[&#039;auth_sentrydescription&#039;]&amp;lt;/code&amp;gt;, and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language/locale codes used in your moodle installation. For example, the lang folder in own users system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. He emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement &amp;lt;tt&amp;gt;config_form()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;process_config()&amp;lt;/tt&amp;gt; in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the &amp;lt;tt&amp;gt;mdl_config_pluginstable&amp;lt;/tt&amp;gt; in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82715</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82715"/>
		<updated>2011-04-12T06:47:18Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: Undo revision 82714 by Wmasterj (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82714</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82714"/>
		<updated>2011-04-12T06:46:19Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files.&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82713</id>
		<title>Development:Authentication API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_API&amp;diff=82713"/>
		<updated>2011-04-12T06:40:35Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Moodle authentication interface==&lt;br /&gt;
&lt;br /&gt;
Authentication API This file describes Moodle interface functions to authentication modules. (This page is incomplete , I&#039;ll update it after I have phpdoc commented auth/ldap/lib.php)&lt;br /&gt;
&lt;br /&gt;
Most of functions are from ldap-authentication module and are not implemented (yet?) on other modules. Please feel free to extend other modules to support same features or roll your own module.&lt;br /&gt;
&lt;br /&gt;
Some of new function are still tested and are not documented here yet.&lt;br /&gt;
&lt;br /&gt;
==Authentication functions==&lt;br /&gt;
&lt;br /&gt;
Basic functions to authenticate users with external db&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Mandatory:===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_login ($username, $password)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Authenticate username, password with userdatabase.&lt;br /&gt;
&lt;br /&gt;
Returns: true if the username and password work and false if they don&#039;t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional:===&lt;br /&gt;
&lt;br /&gt;
Following functions are optional , but if present they extend module usability with Moodle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userinfo($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Query other userinformation from database.&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
&lt;br /&gt;
User information in array &#039;&#039;(name =&amp;gt; value, ...)&#039;&#039; or &#039;&#039;false&#039;&#039; in case of error. Function honors update-flags so if&lt;br /&gt;
&amp;lt;code&amp;gt;$CFG-&amp;gt;auth_user_(atribute)_updatelocal&amp;lt;/code&amp;gt;&lt;br /&gt;
is present, it will return value only if flag is true.&lt;br /&gt;
&lt;br /&gt;
===COURSE CREATING===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_iscreator($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
should user have rights to create courses&lt;br /&gt;
&lt;br /&gt;
Returns: True if user has rights to create cources otherwise false&lt;br /&gt;
&lt;br /&gt;
===USER CREATION===&lt;br /&gt;
&lt;br /&gt;
Functions that enable user creation, activation and deactivation from moodle to external database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_exists ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Checks if given username exists on external db&lt;br /&gt;
&lt;br /&gt;
Returns: true if given usernname exist or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_create ($userobject,$plainpass)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Creates new user to external db. User should be created in inactive stage until confirmed by email.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_activate ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
activate new user after email-address is confirmed&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_user_disable ($username)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
deactivate user in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: True on success otherwise false&lt;br /&gt;
&lt;br /&gt;
=== USER INFORMATION AND SYNCRONIZATION ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_userlist ()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get list of usernames in external db.&lt;br /&gt;
&lt;br /&gt;
Returns: All usernames in array or false on error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth_get_users($filter=&#039;*&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get ALL USEROBJECTS FROM EXTERNAL DB.&lt;br /&gt;
&lt;br /&gt;
Returns: Array of all users as objects from external db &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Authentication API]]&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:API Аутентификации]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82712</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82712"/>
		<updated>2011-04-12T06:38:41Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82711</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82711"/>
		<updated>2011-04-12T06:37:22Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Creating and enabling an authentication plugin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage_authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82710</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82710"/>
		<updated>2011-04-12T06:36:02Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Authentication API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* Moodle Docs [[Manage_authentication]]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82709</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82709"/>
		<updated>2011-04-12T06:31:04Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=82707</id>
		<title>Development:Finding your way into the Moodle code</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=82707"/>
		<updated>2011-04-12T06:22:38Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Tools that can help */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is aimed at people totally new to Moodle development and have some PHP experience, if you don&#039;t have that experience please visit [[Development:PHP for novices|PHP for novices]]. It is a few tips to help you get started with the mass of Moodle code.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add more tips here, but I think it is also good if we can keep this article quite short.&lt;br /&gt;
&lt;br /&gt;
==Developer documentation==&lt;br /&gt;
&lt;br /&gt;
If you have not already found it, the main source of developer documentation is [[Development:Developer_documentation]].&lt;br /&gt;
&lt;br /&gt;
==Finding a way in==&lt;br /&gt;
&lt;br /&gt;
For finding where to start, you need to know that when you are looking at, for example, http://moodle.org/mod/forum/discuss.php?d=82799, then the code for that is in /mod/forum/discuss.php, and you just need to follow through what it does.&lt;br /&gt;
&lt;br /&gt;
It calls functions in the main Moodle libraries, and the three most important are:&lt;br /&gt;
&lt;br /&gt;
*lib/moodlelib.php - general stuff.&lt;br /&gt;
*lib/weblib.php - things to do with output of HTML&lt;br /&gt;
*lib/dmllib.php - things to do with getting data in and out of the database.&lt;br /&gt;
&lt;br /&gt;
==Understanding what you find==&lt;br /&gt;
&lt;br /&gt;
As you look at the code, it is often a good idea, to insert statements like &lt;br /&gt;
 debugging(&#039;In function require_login&#039;);&lt;br /&gt;
which will print the message above if it gets far enough so you know the code has not stalled before there, or&lt;br /&gt;
 print_object($course);&lt;br /&gt;
which will print out a variable, showing you what it contains. &lt;br /&gt;
&lt;br /&gt;
Variable like $course are often objects with lots of fields. Seeing what they contain will help you understand what is going on. The first of these prints out whatever text you give it, and information about the sequence of function calls that the code took to get there. (It only works if you go to &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Debugging]]&#039;&#039;, and turn the debug level to ALL or DEVELOPER.)&lt;br /&gt;
&lt;br /&gt;
==Tools that can help==&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Eclipse&#039;&#039;&#039;, for instance helps finding function definitions. You can hold down CTRL and click on the name of a function, it immediately jumps you to where that function is defined. ([[Development:Setting_up_Eclipse]])&lt;br /&gt;
*&#039;&#039;&#039;Emacs&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;Vim&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;TextMate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
See also [[Development:Developer documentation#Tools]] and [[:Category:Developer tools]].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming] a course at dev.moodle.org&lt;br /&gt;
* [[Development FAQ]]&lt;br /&gt;
* [[Development:Developer_documentation]]&lt;br /&gt;
* [[Development:Overview]]&lt;br /&gt;
* [[Development:ctags]]&lt;br /&gt;
* [http://blog.danpoltawski.co.uk/archives/2009-05-Secrets-of-Learning-Moodle-Development!.html &amp;quot;Secrets of Learning Moodle Development!&amp;quot;] by Moodle core developer [[User:Dan Poltawski| Dan Poltawski]]&lt;br /&gt;
* http://www.slideshare.net/tjh1000/a-basic-introduciton-to-the-moodle-architecture-5442122&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Developer_FAQ&amp;diff=82706</id>
		<title>Development:Developer FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Developer_FAQ&amp;diff=82706"/>
		<updated>2011-04-12T06:21:48Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Is there any information on creating a new module or plugin? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Help for new coders==&lt;br /&gt;
&lt;br /&gt;
===Where can I start?===&lt;br /&gt;
&lt;br /&gt;
* [[Development:Finding your way into the Moodle code]]&lt;br /&gt;
* [http://dev.moodle.org/ Moodle Developer Courses]&lt;br /&gt;
&lt;br /&gt;
===Where can &amp;quot;newbies&amp;quot; to Moodle get help?===&lt;br /&gt;
&lt;br /&gt;
The [http://moodle.org/mod/forum/view.php?f=33 General developer forum]! Feel free to ask any question, no matter how basic or advanced. Many people ask different levels of question every day, and the community is generally welcoming and quick to respond.&lt;br /&gt;
&lt;br /&gt;
===How do I create a patch?===&lt;br /&gt;
&lt;br /&gt;
See [[Development:How to create a patch]].&lt;br /&gt;
&lt;br /&gt;
=== How do I create a new module or plugin? ===&lt;br /&gt;
&lt;br /&gt;
See&lt;br /&gt;
* [[Development:NEWMODULE Documentation]] &lt;br /&gt;
* [[Development:Blocks]] &lt;br /&gt;
* [[Development:Authentication plugins]]&lt;br /&gt;
* [[Development:Developer_documentation#Make_a_new_plugin|full list of plugin types]].&lt;br /&gt;
* Also have a look at the [http://dev.moodle.org/ Moodle Developer Courses].&lt;br /&gt;
&lt;br /&gt;
; Book&lt;br /&gt;
: [https://www.packtpub.com/moodle-1-9-extension-development/book Moodle 1.9 Extension Development - Customize and extend Moodle using its robust plug-in systems] by Jonathan Moore, Michael Churchward - highly recommended&lt;br /&gt;
&lt;br /&gt;
===Is there any information on backup and restore?===&lt;br /&gt;
&lt;br /&gt;
See [[Development:Backup]].&lt;br /&gt;
&lt;br /&gt;
==I can&#039;t use one of the available plug-in points to make my change. What alternative is there?==&lt;br /&gt;
&lt;br /&gt;
See [[Development:Local customisation]].&lt;br /&gt;
&lt;br /&gt;
==Moodle&#039;s database==&lt;br /&gt;
&lt;br /&gt;
===Where can I see a schema for the structure of the Moodle database?===&lt;br /&gt;
&lt;br /&gt;
[[Development:Database_schema_introduction]] gives a high level overview of the database schema.&lt;br /&gt;
&lt;br /&gt;
Because of Moodle&#039;s modular nature, there is no single, detailed representation of the full database schema. Instead, the tables for each part of Moodle are defined in a database-neutral XML format, see [[Database_FAQ#XMLDB| XMLDB]], in each part of Moodle. Look for files called install.xml in folders called db throughout the code. Alternatively, from Moodle 2.0 onwards, go to Administration -&amp;gt; Development -&amp;gt; XMLDB editor, and use the [Doc] links to see automatically generated documentation built form the comments in the install.xml files.&lt;br /&gt;
&lt;br /&gt;
See also [[Database FAQ]].&lt;br /&gt;
&lt;br /&gt;
==How to get/set information when writing new Moodle code==&lt;br /&gt;
&lt;br /&gt;
===How do I find out the currently-logged-on user?===&lt;br /&gt;
&lt;br /&gt;
The global object $USER, which contains the numeric $USER-&amp;gt;id among other things.&lt;br /&gt;
&lt;br /&gt;
===How do I find out the current course?===&lt;br /&gt;
The global object $COURSE, which contains the numeric $COURSE-&amp;gt;id&lt;br /&gt;
&lt;br /&gt;
===How do I insert/retrieve records in the database, without creating my own database connections?===&lt;br /&gt;
&lt;br /&gt;
Always use the &amp;quot;datalib&amp;quot; functions, such as insert_record() or get_record(). Since Moodle 1.7 these are found in lib/dmllib.php. Using these functions helps with database abstraction (e.g. running on either MySQL or Postgres) as well as maintaining a single database connection. Moodle uses ADODB for database abstraction.&lt;br /&gt;
&lt;br /&gt;
See [http://xref.moodle.org/nav.html?lib/datalib.php.html /lib/datalib.php] for higher level functions and [http://xref.moodle.org/nav.html?lib/dmllib.php.html /lib/dmllib.php] for lower level functions.&lt;br /&gt;
&lt;br /&gt;
Look at [http://phpdocs.moodle.org/19/moodlecore/_lib---datalib.php.html  the documentation for datalib.php] for the list of functions and details of use.&lt;br /&gt;
&lt;br /&gt;
See [[Development talk:Coding style#Database code]] for further details.&lt;br /&gt;
&lt;br /&gt;
===How do I get/set configuration settings?===&lt;br /&gt;
&lt;br /&gt;
;config table&lt;br /&gt;
To get config values you would typically access the global $CFG object directly, which is automatically created by the core Moodle scripts. To set these &amp;quot;main&amp;quot; config values use &#039;&#039;set_config($name, $value)&#039;&#039;. The values are stored in the Moodle &amp;quot;config&amp;quot; database table, but these functions take care of cacheing on your behalf, so you should always use these rather than fetching the records directly.&lt;br /&gt;
&lt;br /&gt;
;config_plugin table&lt;br /&gt;
There is also a second table of config settings specifically for plugins (&amp;quot;config_plugin&amp;quot;). These are not automatically loaded into the $CFG object, so to fetch these you would use get_config($plugin, $name). To set them use set_config($name, $value, $plugin).&lt;br /&gt;
&lt;br /&gt;
On top of those global configuration values, individual blocks may also have configuration &amp;quot;object&amp;quot; associated with it (the data is serialized and stored in the &amp;quot;block_instance&amp;quot; table). Within blocks, this data is automatically loaded into the &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; attribute of the block.&lt;br /&gt;
&lt;br /&gt;
==What is &#039;HEAD&#039;?==&lt;br /&gt;
&lt;br /&gt;
HEAD is version control jargon for the latest version, so at the moment it means Moodle 2.0 dev version. (After the Moodle 2.0 stable branch is made, HEAD will mean 2.1 dev). Look for example, at the links at the top of http://cvs.moodle.org/moodle/README.txt?view=log&amp;amp;pathrev=MOODLE_19_STABLE You can get it from http://download.moodle.org/ and install it if you want to play.&lt;br /&gt;
&lt;br /&gt;
== How do I migrate code to Moodle 2.0? ==&lt;br /&gt;
* See [[Development:Migrating contrib code to 2.0]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Contributed code FAQ]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?f=33 General developer forum]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55719 How does date / time in DB convert to real Date / Time?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=158521 Why git?]&lt;br /&gt;
&lt;br /&gt;
[[Category: Developer]]&lt;br /&gt;
[[Category: FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:FAQ Desarrollador]]&lt;br /&gt;
[[fr:FAQ de développement]]&lt;br /&gt;
[[pl:Developer FAQ]]&lt;br /&gt;
[[ru:Development:Developer FAQ]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82705</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82705"/>
		<updated>2011-04-12T06:19:21Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
* [[Authentication FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82702</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82702"/>
		<updated>2011-04-12T05:55:32Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: General formatting to improve readability since it is really hard to digest all this text.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an &#039;&#039;&#039;overview&#039;&#039;&#039; of the &#039;&#039;authentication process&#039;&#039; and then explains how &#039;&#039;authentication modules&#039;&#039; can be &#039;&#039;&#039;created&#039;&#039;&#039; using hooks to take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
[[File:1.9.11_login_element.png|203px||thumb|right|The login UI element in Moodle 1.9]]The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# The default login page (&amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt;) is displayed. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# A user enters their credentials and submits the form.&lt;br /&gt;
# The handler code in &amp;lt;tt&amp;gt;/login/index.php&amp;lt;/tt&amp;gt; runs:&lt;br /&gt;
## Gets a list of enabled authentication plugins.&lt;br /&gt;
## Runs &amp;lt;tt&amp;gt;loginpage_hook()&amp;lt;/tt&amp;gt; for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## Checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## Calls &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/lib/moodlelib.php&amp;lt;/tt&amp;gt;, which returns a &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; object. (Details of this code follow this main outline.)&lt;br /&gt;
## Determines whether authentication was successful (by checking whether &amp;lt;tt&amp;gt;$user&amp;lt;/tt&amp;gt; is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;===&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in &amp;lt;tt&amp;gt;authenticate_user_login()&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. ([[Development:Places_to_search_for_lang_strings|More info on how Moodle handles language]]).&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82700</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82700"/>
		<updated>2011-04-12T05:26:08Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an overview of the authentication process and then explains how authentication modules can be used to hook into that process and take over from the native authentication in Moodle.&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# If using the default login page, the page /login/index.php is displayed, asking for the user&#039;s credentials. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# User enters their credentials and submits the form.&lt;br /&gt;
# The handler code in /login/index.php runs:&lt;br /&gt;
## It gets a list of enabled authentication plugins.&lt;br /&gt;
## It runs loginpage_hook() for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## It checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## It calls authenticate_user_login() in /lib/moodlelib.php, which returns a $user object. (Details of this code follow this main outline.)&lt;br /&gt;
## It determines whether authentication was successful (by checking whether $user is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in authenticate_user_login():&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. For more information on how Moodle handles such language files, see [[Development:Places_to_search_for_lang_strings]].&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82699</id>
		<title>Development:Authentication plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Authentication_plugins&amp;diff=82699"/>
		<updated>2011-04-12T05:25:52Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: copy (you guys need a content editor)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page first gives an overview of the authentication process and then explains how authentication modules can be used to hook into that process and take over from the native authentication in Moodle.&lt;br /&gt;
&lt;br /&gt;
== Overview of Moodle authentication process ==&lt;br /&gt;
The authentication use case in Moodle starts when a user clicks on the Login link in the UI. Then the following happens (skipping some minor details and rarer scenarios):&lt;br /&gt;
&lt;br /&gt;
# If using the default login page, the page /login/index.php is displayed, asking for the user&#039;s credentials. OR, if a system administrator has set the Alternate Login URL on the &amp;quot;Manage authentication&amp;quot; page, that URL will be displayed.&lt;br /&gt;
# User enters their credentials and submits the form.&lt;br /&gt;
# The handler code in /login/index.php runs:&lt;br /&gt;
## It gets a list of enabled authentication plugins.&lt;br /&gt;
## It runs loginpage_hook() for each plugin, in case any of them needs to intercept the login request.&lt;br /&gt;
## It checks to make sure that the username meets Moodle&#039;s criteria (alphanumeric, with periods and hyphens allowed).&lt;br /&gt;
## It calls authenticate_user_login() in /lib/moodlelib.php, which returns a $user object. (Details of this code follow this main outline.)&lt;br /&gt;
## It determines whether authentication was successful (by checking whether $user is a valid object) and, if not, sends them back to the login page with an error message. Otherwise, it figures out where to send the user based on their original page request, whether their password is expired, etc., and redirects them there.&lt;br /&gt;
&lt;br /&gt;
That&#039;s the main outline, but a lot of interesting stuff happens in authenticate_user_login():&lt;br /&gt;
&lt;br /&gt;
# It gets a list of enabled authentication plugins.&lt;br /&gt;
# It looks up the username in the mdl_user table to see if they are allowed to log in, and which authentication plugin handles their login requests. (This will be the plugin that handled their first-ever login request.)&lt;br /&gt;
# It creates a user object, which will contain the data from mdl_user if the username is known; if not, it will be an empty object.&lt;br /&gt;
# It does the following with the authentication plugin (note that for a username unknown to Moodle, it will do these steps for each authenticated plugin until one succeeds or it has tried them all):&lt;br /&gt;
## Calls the user_login() function provided by that plugin, which returns a boolean value based on whether the credentials authenticate or not. If the result is false (not authenticated), skips the rest of the steps below and continues to the next plugin.&lt;br /&gt;
## If the plugin authenticates against an external system (not Moodle&#039;s user database), its update_user_record() function is called to get the user&#039;s name, contact info, etc.&lt;br /&gt;
## Creates the Moodle user record if it doesn&#039;t already exist.&lt;br /&gt;
## Calls the plugin&#039;s sync_roles() function (I am not clear what this is exactly supposed to do).&lt;br /&gt;
## Notifies each enabled authentication plugin that the user successfully authenticated, by calling each one&#039;s user_authenticated_hook() function.&lt;br /&gt;
# It returns the user object if everything was successful, or false if no plugin was able to successfully authenticate the credentials.&lt;br /&gt;
&lt;br /&gt;
== Creating and enabling an authentication plugin ==&lt;br /&gt;
To create and register an authentication plugin, do the following:&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your plugin.  We&#039;ll use &#039;sentry&#039; as an example below; change it to whatever name you have chosen.&lt;br /&gt;
# Under your Moodle installation root, create the directory /auth/sentry.  It should be sibling to existing auth plugin directories: &#039;db&#039;, &#039;nologin&#039;, &#039;none&#039;, etc.&lt;br /&gt;
# Create the file /auth/sentry/auth.php.  Within the file, create a class auth_plugin_sentry that extends auth_plugin_base from /lib/authlib.php.  (You will need to require_once the authlib file.)&lt;br /&gt;
# Implement the user_login() function in your auth.php file, and create or override additional functions based on your plugin&#039;s requirements.&lt;br /&gt;
# Log in to your Moodle installation as a site administrator and find, in the site administrator block, the page &amp;quot;Users -&amp;gt; Authentication -&amp;gt; Manage authentication&amp;quot;.  You will see your plugin in the list, appearing as &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt;.  You can enable it and move it up and down in the order.  &#039;&#039;&#039;At this point, with the plugin enabled, your plugin is registered and will be used by Moodle in its authentication process.&#039;&#039;&#039;&lt;br /&gt;
# If you don&#039;t like seeing &amp;lt;nowiki&amp;gt;[[auth_sentrytitle]]&amp;lt;/nowiki&amp;gt; as the name of your plugin in the Moodle UI, you&#039;ll need to create language files for your plugin.  Do this by creating the directory /auth/sentry/lang, and under it, a directory for each language that your installation needs to support.  (Example: /auth/sentry/lang/en_us_utf8.)  Within each of these language directories, create a file called auth_sentry.php.  That file should set the desired value for $string[&#039;auth_sentrytitle&#039;] for that language.  You can also set the plugin description by setting $string[&#039;auth_sentrydescription&#039;], and you can also assign other translatable strings that your plugin uses, in these files. &#039;&#039;&#039;Note:&#039;&#039;&#039; A folder named like &#039;&#039;&#039;en_us_utf8&#039;&#039;&#039; may not work for everyone. Please refer to the lang folder under your moodle installation directory to get an idea about the language / locale codes used in your moodle installation. For example, the lang folder in my system contained two folders named &#039;&#039;&#039;en&#039;&#039;&#039; and &#039;&#039;&#039;en_utf8&#039;&#039;&#039;. I emulated the same in the lang folder of the auth plugin and the plugin picked up the title and description strings immediately. For more information on how Moodle handles such language files, see [[Development:Places_to_search_for_lang_strings]].&lt;br /&gt;
# If you want to configure your plugin through the Moodle UI, implement config_form() and process_config() in the plugin class.  You might find it convenient to use the &#039;db&#039; plugin as a model for this.  The plugin&#039;s config settings can then be managed through the Manage authentication page by clicking on the Settings link for that plugin, and the values will be stored in the mdl_config_pluginstable in the database.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=102070 Overview of entire authentication code flow] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Méthodes_d&#039;authentification]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=77019</id>
		<title>Development talk:Roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=77019"/>
		<updated>2010-10-23T19:26:08Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Let&amp;#039;s start a new guideline for the wiki */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chris, I put back the forum moderator example. I think it was intentional. We want to get people thinking outside the box of what previous versions were capable of.&lt;br /&gt;
&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The list of capabilities for some activities should include viewing as a separate capability since it is a distinct action from editing or taking part, for example&lt;br /&gt;
&lt;br /&gt;
choice_canviewresults&lt;br /&gt;
&lt;br /&gt;
== legacy support for isstudent() and isteacher() ==&lt;br /&gt;
&lt;br /&gt;
We could provide legacy support for modules (and core) to continue using isstudent() and isteacher() calls, by replacing these with stubs that simply wrap the new access control API and feed in the proper parameters. This might help reduce the initial effort (i.e., you don&#039;t HAVE to update every. single. module. at first, just the ones most affected by this API change. then, as time allows, and as modules are being updated anyway, migrate them to the new API)&lt;br /&gt;
&lt;br /&gt;
almost forgot - totally looking forward to this feature. any ETA?&lt;br /&gt;
&lt;br /&gt;
== What are the legacy capabilities for? ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve been reading the Roles documentation, and my a lot of work going on in here! Keep it up! I might be understanding something incorrectly as I can&#039;t figure out what the legacy capabilities are for? I thought that Roles are sets of capabilities. There might/should be Roles for all of the &amp;quot;legacy roles&amp;quot;, which would then have the default set of capabilities matching the capabilities in 1.6. What are the &amp;quot;legacy capabilities&amp;quot; then? --[[User:Samuli Karevaara|Samuli Karevaara]] 07:27, 1 September 2006 (CDT)&lt;br /&gt;
:No answer yet... This was also asked in the [http://moodle.org/mod/forum/discuss.php?d=61269 forums]. --[[User:Samuli Karevaara|Samuli Karevaara]] 04:43, 18 January 2007 (CST)&lt;br /&gt;
&lt;br /&gt;
== Page too long? ==&lt;br /&gt;
&lt;br /&gt;
I think this page is a bit too long and could profit from some refactoring, for example reducing some redundancies with other pages like [[Development:Roles and modules]] or integrating [[Development:Local customisation]]. --[[User:Frank Ralf|Frank Ralf]] 17:14, 27 March 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Let&#039;s start a new guideline for the wiki ==&lt;br /&gt;
&lt;br /&gt;
I am a new user and developer for Moodle at the University of Washington and time and time again I get frustrated about the use of first person everywhere:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;I added these questions here because...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Who cares about you? I suggest a new guideline that encourages everyone to write more like:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Here follows a questions section, the reason we have it is...&amp;quot; &lt;br /&gt;
&lt;br /&gt;
I get pretty turned of myself to edit any documentation in this Wiki because there are so many &amp;quot;I&amp;quot;&#039;s everywhere that it seems like one or two people are editing everything and if I do any thing to it that person would get upset. This is wrong an is an inhibitor to the fact that you probably want loads of people adding to and editing the wiki. Since I am new, please forward this to some wiki admin who can take this into consideration and add to a guideline somewhere (i don&#039;t know where they are).&lt;br /&gt;
&lt;br /&gt;
Thanks --[[User:Jeroen van den Eijkhof|Jeroen van den Eijkhof]] 04:10, 23 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
: I have no idea how the above comment relates to the [[Development:Roles]] page. If you want to hold a meta-discussion about Moodle documentation, http://moodle.org/mod/forum/view.php?id=5838 might be a better place.&lt;br /&gt;
&lt;br /&gt;
: It think it is reasonable to distinguish content on this wiki that is uncontroversial statements of fact (This is how X works: ...) from parts that are one particular opinion on a topic, but where other opinions are possible (I find that a good way to structure my files is ... --Tim]]. Of course this wiki is not the place for personal expressions of idiosyncratic opinions, but when you are writing something in the hope that it will be useful to a lot of people most of the time, but which in not the only right way, I think it is reasonable to flag this is some way, and using I, with a signature, so people can judge the source of the advice, seems like a reasonable approach to me.--[[User:Tim Hunt|Tim Hunt]] 07:22, 23 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Yes, that is reasonably. But clear and structured communication is so important when it comes to the growth of an open source community. And if you do voice a personal opinion that could be put in the discussion page or if you do put that in the documentation and no one changes it then that should be a sign of it being. --[[User:Jeroen van den Eijkhof|Jeroen van den Eijkhof]] 19:26, 23 October 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=77016</id>
		<title>Development talk:Roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=77016"/>
		<updated>2010-10-23T19:16:48Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Let&amp;#039;s start a new guideline for the wiki */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chris, I put back the forum moderator example. I think it was intentional. We want to get people thinking outside the box of what previous versions were capable of.&lt;br /&gt;
&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The list of capabilities for some activities should include viewing as a separate capability since it is a distinct action from editing or taking part, for example&lt;br /&gt;
&lt;br /&gt;
choice_canviewresults&lt;br /&gt;
&lt;br /&gt;
== legacy support for isstudent() and isteacher() ==&lt;br /&gt;
&lt;br /&gt;
We could provide legacy support for modules (and core) to continue using isstudent() and isteacher() calls, by replacing these with stubs that simply wrap the new access control API and feed in the proper parameters. This might help reduce the initial effort (i.e., you don&#039;t HAVE to update every. single. module. at first, just the ones most affected by this API change. then, as time allows, and as modules are being updated anyway, migrate them to the new API)&lt;br /&gt;
&lt;br /&gt;
almost forgot - totally looking forward to this feature. any ETA?&lt;br /&gt;
&lt;br /&gt;
== What are the legacy capabilities for? ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve been reading the Roles documentation, and my a lot of work going on in here! Keep it up! I might be understanding something incorrectly as I can&#039;t figure out what the legacy capabilities are for? I thought that Roles are sets of capabilities. There might/should be Roles for all of the &amp;quot;legacy roles&amp;quot;, which would then have the default set of capabilities matching the capabilities in 1.6. What are the &amp;quot;legacy capabilities&amp;quot; then? --[[User:Samuli Karevaara|Samuli Karevaara]] 07:27, 1 September 2006 (CDT)&lt;br /&gt;
:No answer yet... This was also asked in the [http://moodle.org/mod/forum/discuss.php?d=61269 forums]. --[[User:Samuli Karevaara|Samuli Karevaara]] 04:43, 18 January 2007 (CST)&lt;br /&gt;
&lt;br /&gt;
== Page too long? ==&lt;br /&gt;
&lt;br /&gt;
I think this page is a bit too long and could profit from some refactoring, for example reducing some redundancies with other pages like [[Development:Roles and modules]] or integrating [[Development:Local customisation]]. --[[User:Frank Ralf|Frank Ralf]] 17:14, 27 March 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Let&#039;s start a new guideline for the wiki ==&lt;br /&gt;
&lt;br /&gt;
I am a new user and developer for Moodle at the University of Washington and time and time again I get frustrated about the use of first person everywhere:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;I added these questions here because...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Who cares about you? I suggest a new guideline that encourages everyone to write more like:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Here follows a questions section, the reason we have it is...&amp;quot; &lt;br /&gt;
&lt;br /&gt;
I get pretty turned of myself to edit any documentation in this Wiki because there are so many &amp;quot;I&amp;quot;&#039;s everywhere that it seems like one or two people are editing everything and if I do any thing to it that person would get upset. This is wrong an is an inhibitor to the fact that you probably want loads of people adding to and editing the wiki. Since I am new, please forward this to some wiki admin who can take this into consideration and add to a guideline somewhere (i don&#039;t know where they are).&lt;br /&gt;
&lt;br /&gt;
Thanks --[[User:Jeroen van den Eijkhof|Jeroen van den Eijkhof]] 04:10, 23 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
: I have no idea how the above comment relates to the [[Development:Roles]] page. If you want to hold a meta-discussion about Moodle documentation, http://moodle.org/mod/forum/view.php?id=5838 might be a better place.&lt;br /&gt;
&lt;br /&gt;
: It think it is reasonable to distinguish content on this wiki that is uncontroversial statements of fact (This is how X works: ...) from parts that are one particular opinion on a topic, but where other opinions are possible (I find that a good way to structure my files is ... --Tim]]. Of course this wiki is not the place for personal expressions of idiosyncratic opinions, but when you are writing something in the hope that it will be useful to a lot of people most of the time, but which in not the only right way, I think it is reasonable to flag this is some way, and using I, with a signature, so people can judge the source of the advice, seems like a reasonable approach to me.--[[User:Tim Hunt|Tim Hunt]] 07:22, 23 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Yes, that is reasonably. But clear and structured communication is so important when it comes to the growth of an open source community. And if you do voice a personal opinion that could be put in the discussion page or if you do put that in the documentation and no one changes it then that should be a sign of it being ok.&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=77015</id>
		<title>Blocks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=77015"/>
		<updated>2010-10-23T19:12:29Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Course edit on new 4.JPG|thumb|right|Default block positions for a new course page]]&lt;br /&gt;
A &#039;&#039;&#039;Moodle block&#039;&#039;&#039; is a plugin that load in the right-hand and left-hand side of the page, where they can display different types of information.&lt;br /&gt;
&lt;br /&gt;
A teacher can utilize many kinds of blocks in a course page. Typically a course home page contains blocks in the left and right columns.&lt;br /&gt;
&lt;br /&gt;
==Block types==&lt;br /&gt;
There are many different types of blocks in a course that can be used by a teacher. The teacher can add blocks from a pull down menu.  Other blocks provide information or settings that a teacher may use.  Some activities allow blocks to be inserted by the teacher.&lt;br /&gt;
&lt;br /&gt;
===Pull down===&lt;br /&gt;
Each course has an add block pull down menu.&lt;br /&gt;
{| border=&amp;quot;0&amp;quot;&lt;br /&gt;
| | &lt;br /&gt;
{| border=&amp;quot;2&amp;quot;;&amp;quot;&lt;br /&gt;
|[[Blogs|Blogs - Tags and Menu]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Calendar block|Calendar]] - display calendar&lt;br /&gt;
|-&lt;br /&gt;
|[[Global Search block]]&lt;br /&gt;
|-&lt;br /&gt;
|[[HTML block|HTML]] - Use HTML editor in content area&lt;br /&gt;
|-&lt;br /&gt;
|[[Loan calculator block|Loan Calculator]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Mentees block]] (from 1.8 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Messages block|Messages]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Online Users block|Online Users]] - only online Participants&lt;br /&gt;
|-&lt;br /&gt;
|[[People block|People]] - link to [[Participants]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Quiz Results]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Random Glossary Entry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Remote RSS Feeds]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Section Links]]&lt;br /&gt;
|}&lt;br /&gt;
| style=&amp;quot;width:100px&amp;quot; |  &lt;br /&gt;
|[[Image:Block add dropdown list teacher 1 8.JPG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Other blocks===&lt;br /&gt;
*[[Sticky blocks]] A block that is forced to appear on every page as part of a site setting&lt;br /&gt;
*[[Activities block|Activities]] A block used by teachers to add activities&lt;br /&gt;
*[[Course administration block]] contains course settings.&lt;br /&gt;
*[[Courses block|Courses]] Lists student&#039;s courses&lt;br /&gt;
*[[Course/Site Description block|Course/Site Description]] Teacher&#039;s description of course&lt;br /&gt;
*[[Latest News block|Latest News]]&lt;br /&gt;
*[[Recent Activity block|Recent Activity]]&lt;br /&gt;
*[[Search Forums block|Search Forums]]&lt;br /&gt;
*[[Upcoming Events block|Upcoming Events]]&lt;br /&gt;
&lt;br /&gt;
There are also many contributed blocks available for download from the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database] including:&lt;br /&gt;
&lt;br /&gt;
*[[Youtube block|Youtube]]&lt;br /&gt;
*[[Flickr block|Flickr]]&lt;br /&gt;
*[[Side bar block]]&lt;br /&gt;
*[[Progress Bar block]]&lt;br /&gt;
*[[Unanswered Discussions block]]&lt;br /&gt;
*[[Simple Clock block]]&lt;br /&gt;
&lt;br /&gt;
==Course page block arrangement==&lt;br /&gt;
[[Image:Block_People.JPG |frame|The People block with editing turned on]]&lt;br /&gt;
Teachers, and other users with the capability to manage course activities, can change the arrangement of blocks on the course page (apart from [[Sticky blocks]]) when editing is turned on.&lt;br /&gt;
&lt;br /&gt;
New blocks can be added using the Add blocks dropdown menu. Existing blocks (apart from [[Sticky blocks]]) can be hidden, deleted or moved using the icons in the block header.&lt;br /&gt;
&lt;br /&gt;
==Adding blocks to activities==&lt;br /&gt;
Certain activity modules, such as the [[Lesson module]] and the [[Quiz module]], support blocks on their pages. The site administrator must turn this function on so that the teachers will be able to add side blocks on those pages, otherwise the interface does not show this feature to the teacher.&lt;br /&gt;
&lt;br /&gt;
By default, this feature is disabled in the [[Site administration block]]. An administrator can enable it by checking the &#039;&#039;showblocksonmodpages&#039;&#039; box in &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings&#039;&#039;.  When enabled, users who can manage course activities will be able to add blocks to pages.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Blocks FAQ]]&lt;br /&gt;
*[[Block permissions]]&lt;br /&gt;
*[[Blocks administration]] - site block settings that an administrator can use&lt;br /&gt;
*[[Site administration block]]&lt;br /&gt;
*[[Development:Blocks]] - a developer guide to creating blocks&lt;br /&gt;
*[[:Category:Block]] - an index of all block-related pages&lt;br /&gt;
*[[:Category:Contributed code]] including a number of contributed blocks&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2121 Blocks forum]&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
[[de:Blöcke]]&lt;br /&gt;
[[eu:Irakaslearen_blokeak]]&lt;br /&gt;
[[fr:Blocs (enseignant)]]&lt;br /&gt;
[[ja:ブロック]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=77014</id>
		<title>Blocks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=77014"/>
		<updated>2010-10-23T19:12:04Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Course edit on new 4.JPG|thumb|right|Default block positions for a new course page]]&lt;br /&gt;
A Moodle &#039;&#039;&#039;block&#039;&#039;&#039; is a plugin that load in the right-hand and left-hand side of the page, where they can display different types of information.&lt;br /&gt;
&lt;br /&gt;
A teacher can utilize many kinds of blocks in a course page. Typically a course home page contains blocks in the left and right columns.&lt;br /&gt;
&lt;br /&gt;
==Block types==&lt;br /&gt;
There are many different types of blocks in a course that can be used by a teacher. The teacher can add blocks from a pull down menu.  Other blocks provide information or settings that a teacher may use.  Some activities allow blocks to be inserted by the teacher.&lt;br /&gt;
&lt;br /&gt;
===Pull down===&lt;br /&gt;
Each course has an add block pull down menu.&lt;br /&gt;
{| border=&amp;quot;0&amp;quot;&lt;br /&gt;
| | &lt;br /&gt;
{| border=&amp;quot;2&amp;quot;;&amp;quot;&lt;br /&gt;
|[[Blogs|Blogs - Tags and Menu]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Calendar block|Calendar]] - display calendar&lt;br /&gt;
|-&lt;br /&gt;
|[[Global Search block]]&lt;br /&gt;
|-&lt;br /&gt;
|[[HTML block|HTML]] - Use HTML editor in content area&lt;br /&gt;
|-&lt;br /&gt;
|[[Loan calculator block|Loan Calculator]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Mentees block]] (from 1.8 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Messages block|Messages]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Online Users block|Online Users]] - only online Participants&lt;br /&gt;
|-&lt;br /&gt;
|[[People block|People]] - link to [[Participants]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Quiz Results]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Random Glossary Entry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Remote RSS Feeds]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Section Links]]&lt;br /&gt;
|}&lt;br /&gt;
| style=&amp;quot;width:100px&amp;quot; |  &lt;br /&gt;
|[[Image:Block add dropdown list teacher 1 8.JPG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Other blocks===&lt;br /&gt;
*[[Sticky blocks]] A block that is forced to appear on every page as part of a site setting&lt;br /&gt;
*[[Activities block|Activities]] A block used by teachers to add activities&lt;br /&gt;
*[[Course administration block]] contains course settings.&lt;br /&gt;
*[[Courses block|Courses]] Lists student&#039;s courses&lt;br /&gt;
*[[Course/Site Description block|Course/Site Description]] Teacher&#039;s description of course&lt;br /&gt;
*[[Latest News block|Latest News]]&lt;br /&gt;
*[[Recent Activity block|Recent Activity]]&lt;br /&gt;
*[[Search Forums block|Search Forums]]&lt;br /&gt;
*[[Upcoming Events block|Upcoming Events]]&lt;br /&gt;
&lt;br /&gt;
There are also many contributed blocks available for download from the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database] including:&lt;br /&gt;
&lt;br /&gt;
*[[Youtube block|Youtube]]&lt;br /&gt;
*[[Flickr block|Flickr]]&lt;br /&gt;
*[[Side bar block]]&lt;br /&gt;
*[[Progress Bar block]]&lt;br /&gt;
*[[Unanswered Discussions block]]&lt;br /&gt;
*[[Simple Clock block]]&lt;br /&gt;
&lt;br /&gt;
==Course page block arrangement==&lt;br /&gt;
[[Image:Block_People.JPG |frame|The People block with editing turned on]]&lt;br /&gt;
Teachers, and other users with the capability to manage course activities, can change the arrangement of blocks on the course page (apart from [[Sticky blocks]]) when editing is turned on.&lt;br /&gt;
&lt;br /&gt;
New blocks can be added using the Add blocks dropdown menu. Existing blocks (apart from [[Sticky blocks]]) can be hidden, deleted or moved using the icons in the block header.&lt;br /&gt;
&lt;br /&gt;
==Adding blocks to activities==&lt;br /&gt;
Certain activity modules, such as the [[Lesson module]] and the [[Quiz module]], support blocks on their pages. The site administrator must turn this function on so that the teachers will be able to add side blocks on those pages, otherwise the interface does not show this feature to the teacher.&lt;br /&gt;
&lt;br /&gt;
By default, this feature is disabled in the [[Site administration block]]. An administrator can enable it by checking the &#039;&#039;showblocksonmodpages&#039;&#039; box in &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings&#039;&#039;.  When enabled, users who can manage course activities will be able to add blocks to pages.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Blocks FAQ]]&lt;br /&gt;
*[[Block permissions]]&lt;br /&gt;
*[[Blocks administration]] - site block settings that an administrator can use&lt;br /&gt;
*[[Site administration block]]&lt;br /&gt;
*[[Development:Blocks]] - a developer guide to creating blocks&lt;br /&gt;
*[[:Category:Block]] - an index of all block-related pages&lt;br /&gt;
*[[:Category:Contributed code]] including a number of contributed blocks&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2121 Blocks forum]&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
[[de:Blöcke]]&lt;br /&gt;
[[eu:Irakaslearen_blokeak]]&lt;br /&gt;
[[fr:Blocs (enseignant)]]&lt;br /&gt;
[[ja:ブロック]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Cron&amp;diff=77013</id>
		<title>Cron</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Cron&amp;diff=77013"/>
		<updated>2010-10-23T17:41:51Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Invocation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cron is the name of a Unix program that runs predefined tasks on a computer at regular intervals. It assists some of Moodle&#039;s modules to perform tasks on a scheduled basis. For example, the cron process might tell Moodle to check all discussion forums so it can mail out copies of new posts to people who have subscribed to that forum. &lt;br /&gt;
&lt;br /&gt;
The primary Moodle script that does all this is located in the admin directory, and is called cron.php. However, it can not tell itself to run, so you need to set up a mechanism where this script is run regularly (eg every five or ten minutes). This provides a &amp;quot;heartbeat&amp;quot; so that the script can perform functions at periods defined by each module. This kind of regular mechanism is known as a &#039;&#039;&#039;cron service&#039;&#039;&#039;. The service can be part of a webhost or can be something run from a different server or computer.&lt;br /&gt;
&lt;br /&gt;
==Overview of cron==&lt;br /&gt;
===Script overview===&lt;br /&gt;
&lt;br /&gt;
The cron.php script looks through the mdl_modules table (assuming the default table prefix is mdl_) in the Moodle database for modules scheduled to have their cron functions run; it then looks in each such module directory for a function called module-name_cron in the lib.php file and runs it.  It also looks through the mdl_block table for blocks scheduled for their cron methods (object functions) to be run; it then, for each such block, runs the cron method for a new object associated with that block (I&#039;m omitting details for the benefit of non-programmers; programmers can read admin/cron.php for themselves). These files (the lib.php files and the files where the block classes are defined) can contain cleanup functions, email functions or anything that needs to be run on a regular basis. For example, cron will trigger the system to create the backups of courses at the time specified in the administration settings. It also triggers any messaging module or forum email notifications, but not all functions are called each time the cron runs. Some functions, such as unenrolling students who have not logged in or deleting old copies of log files, are only run occasionally. The cron.php file has a section which will randomly call these core tasks approximately 1 in 5 times the cron runs.&lt;br /&gt;
&lt;br /&gt;
===Invocation===&lt;br /&gt;
There are now (1.9) a number of options with respect to how one can invoke cron.php. First off, one can password the invocation of cron.php via its URL. This means whether one calls the script via a browser through an application like wget or curl, or via your own code to the web daemon, the script will not run unless the password is provided,  and this would be transmitted in clear text.&lt;br /&gt;
&lt;br /&gt;
You can also now bar invocation by URL be selecting cronclionly. This sets Moodle so that cron.php cannot be invoked by the Moodle URL. See the illustration below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Menu: Security &amp;gt; Site policies&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:Moodelcronadmin.png]]&lt;br /&gt;
&lt;br /&gt;
While this is identified as CLI (command line interface) this is a bit misleading in that it does not mean that you have to be sitting at a shell account entering the command. If you enable this switch you can invoke cron.php through any set of batch or script files you wish,  but it must be invoked via its correct location in the operating systems file structure.  This can be especially frustrating for those not used to scripting in that environment is not typically provided.&lt;br /&gt;
&lt;br /&gt;
===Cron service location and timing===&lt;br /&gt;
Note that the machine performing the cron &#039;&#039;&#039;does not need to be the same machine that is running Moodle&#039;&#039;&#039;. For example, if you have a limited web hosting service that does not have a cron service, then you might choose to run cron on another server or on your home computer. All that matters is that the cron.php file is called regularly.&lt;br /&gt;
&lt;br /&gt;
The load of this script is not very high, so 5 minutes is usually reasonable, but if you&#039;re worried about it you can reduce the time period to something like 15 minutes or even 30 minutes. It&#039;s best not to make the time period too long, as delaying mail-outs can slow down activity within the course. Remember that mail-outs also wait for the editing time to expire before being queued for sending.&lt;br /&gt;
&lt;br /&gt;
===Testing cron and manual trigger===&lt;br /&gt;
&lt;br /&gt;
First, test that the script works by running it directly from your browser: &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If cron is called from the command line by any user logged in to your Moodle it will create a temporary admin environment in order to run and then log the user out. You can disable command line running of cron by disabling the appropriate section in the cron.php file.&lt;br /&gt;
&lt;br /&gt;
Now, you need to set up some of way of running the script automatically and regularly.&lt;br /&gt;
&lt;br /&gt;
==Managing Cron on Windows systems==&lt;br /&gt;
&lt;br /&gt;
There are two different ways for setting-up Moodle cron.php on Windows systems:&lt;br /&gt;
&lt;br /&gt;
*Use the &#039;&#039;&#039;Moodle Cron package&#039;&#039;&#039;. The simplest way is to use this little package [http://download.moodle.org/download.php/windows/MoodleCron-Setup.exe MoodleCron-Setup.exe], which makes this whole thing very easy by installing a small Windows service. Run it and forget about it! :-)&lt;br /&gt;
*Use a &#039;&#039;&#039;Scheduled Task&#039;&#039;&#039;. If you prefer to use the built-in Windows Scheduler or are having trouble with moodle-cron-for-windows package, you can use wget for windows or php from the command line and setup a scheduled task. Just follow these steps:&lt;br /&gt;
** Choose either the &#039;&#039;&#039;php.exe/php-win.exe (command line binary)&#039;&#039;&#039; or &#039;&#039;&#039;wget&#039;&#039;&#039;&lt;br /&gt;
::The php.exe or php-win.exe binary (for PHP version 5 or later) is installed in your php folder (e.g. c:\php) will give you better performance when running the cron script.&lt;br /&gt;
::If you want to use wget, download a compiled version of wget for windows from the native GNU Win32 ports (http://unxutils.sourceforge.net/), from Heiko Herold&#039;s wget for windows page (http://xoomer.virgilio.it/hherold/) or Bart Puype&#039;s wget for windows page (http://users.ugent.be/~bpuype/wget/). If you use Heiko Herold&#039;s package, copy all of the .DLL files to your C:\Windows\system32 directory. Copy the wget.exe file to c:\windows (this makes sure wget is always in the search path).&lt;br /&gt;
:* Setup a &#039;&#039;&#039;Scheduled Task&#039;&#039;&#039;. &lt;br /&gt;
:: - Go to Start &amp;gt;&amp;gt; Control Panel &amp;gt;&amp;gt; Scheduled Tasks &amp;gt;&amp;gt; Add Scheduled Task.&lt;br /&gt;
:: - Click &amp;quot;Next&amp;quot; to start the wizard:&lt;br /&gt;
:: - Click in the &amp;quot;Browse...&amp;quot; button and browse to c:\php\php.exe or c:\windows\wget.exe and click &amp;quot;Open&amp;quot;&lt;br /&gt;
:: - Type &amp;quot;Moodle Cron&amp;quot; as the name of the task and select &amp;quot;Daily&amp;quot; as the schedule. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Select &amp;quot;12:00 AM&amp;quot; as the start time, perform the task &amp;quot;Every Day&amp;quot; and choose today&#039;s date as the starting date. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Enter the username and password of the user the task will run under (it doesn&#039;t have to be a priviledged account at all). Make sure you type the password correctly. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Mark the checkbox titled &amp;quot;Open advanced properties for this task when I click Finish&amp;quot; and click &amp;quot;Finish&amp;quot;.&lt;br /&gt;
:: - In the new dialog box, type the following in the &amp;quot;Run:&amp;quot; text box: &amp;lt;pre&amp;gt;c:\windows\wget.exe -q -O NUL http://my.moodle.site/moodle/admin/cron.php&amp;lt;/pre&amp;gt; or &amp;lt;pre&amp;gt;c:\php\php-win.exe -f c:\moodle\admin\cron.php&amp;lt;/pre&amp;gt; Replace &amp;quot;c:\moodle&amp;quot; with the path to your moodle directory or &amp;quot;my.moode.site&amp;quot; with the name of your site.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:: - Click on the &amp;quot;Schedule&amp;quot; tab and there in the &amp;quot;Advanced...&amp;quot; button.&lt;br /&gt;
:: - Mark the &amp;quot;Repeat task&amp;quot; checkbox and set &amp;quot;Every:&amp;quot; to 5 minutes, and set &amp;quot;Until:&amp;quot; to &amp;quot;Duration&amp;quot; and type &amp;quot;23&amp;quot; hours and &amp;quot;59&amp;quot; minutes.&lt;br /&gt;
:: - Click &amp;quot;OK&amp;quot; and you are done.&lt;br /&gt;
* &#039;&#039;&#039;Test your scheduled task&#039;&#039;&#039;. You can test that your scheduled task can run successfully by clicking it with the right button and chosing &amp;quot;Run&amp;quot;. If everything is correctly setup, you will briefly see a DOS command window while wget/php executes and fetches the cron page and then it disappears. If you refresh the scheduled tasks folder, you will see the &#039;&#039;Last Run Time column&#039;&#039; (in detailed folder view) reflects the current time, and that the Last Result column displays &amp;quot;0x0&amp;quot; (everything went OK). If either of these is different, then you should recheck your setup.&lt;br /&gt;
* &#039;&#039;&#039;Logging cron output&#039;&#039;&#039;. You may want to log the output of the cron script as it executes, in case you see the job is producing errors, backups are not being completed or users are experiencing delays in receiving forum emails. To do this, adjust the command so that it uses the php.exe and stores the output in a file called (for example c:\moodle\admin\cron.log). Here is an example of the php.exe command:&lt;br /&gt;
&amp;lt;pre&amp;gt;c:\php\php.exe -f c:\moodle\admin\cron.php &amp;gt; c:\moodle\admin\cron.log&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you experience problems logging the output of cron.php to a text file using the above command then read [http://moodle.org/mod/forum/discuss.php?d=139263#p609060 this] message by Iñaki Arenaza for an alternative way to log the output of Cron.&lt;br /&gt;
&lt;br /&gt;
==Managing the cron job on Mac OS X with launchd==&lt;br /&gt;
&lt;br /&gt;
It&#039;s really important to start the cron job every 5 minutes. The cron job assists most of Moodle&#039;s modules to perform tasks on a scheduled basis. For example, the discussion forums can only mail out copies of new posts to all subscribers if the cron job tells Moodle to do this.&lt;br /&gt;
&lt;br /&gt;
In Mac OS X 10.5 you will find the system daemon &#039;&#039;launchd&#039;&#039; for this service. This daemon offers a standardized interface to any user and all programs started automatically by the system. Please look at http://developer.apple.com/macosx/launchd.html for more informations about the configurations and all parameters. &lt;br /&gt;
&lt;br /&gt;
In our case the service should get the web page http://your-server-address/moodle19/admin/cron.php every 5 minutes. The configuration will be done by the file named &#039;&#039;moodle4mac.cron.plist&#039;&#039; which must be placed in the system folder &#039;&#039;/Library/LaunchDaemons/&#039;&#039; ... surely you can use any other file name but it should say something about the function of the service. The extension must be &#039;&#039;.plist&#039;&#039;. After any reboot of your Mac server the cron service will start automaticly because the file is placed in the correct system folder.&lt;br /&gt;
&lt;br /&gt;
===Use the graphical way===&lt;br /&gt;
You can use Lingon to add a new daemon plist or to edit one. It produces the same text as you can write in your text editor. http://sourceforge.net/projects/lingon/files/&lt;br /&gt;
&lt;br /&gt;
[[Image:macosx-lingon.png]]&lt;br /&gt;
&lt;br /&gt;
===Use a text editor===&lt;br /&gt;
Please use a text editor to write the needed file. You can open the Terminal and use the system editors vi or pico. But you can also write the text file with any GUI text editor ... I mostly use TextWrangler ... but do NOT take an editor for formatted texts like Microsoft Word or OpenOffice Writer. You must get pure text!&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple Computer//DTD PLIST 1.0//EN&amp;quot; &lt;br /&gt;
      &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;dict&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;KeepAlive&amp;lt;/key&amp;gt;&amp;lt;false/&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&amp;lt;string&amp;gt;moodle4mac.cron&amp;lt;/string&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&lt;br /&gt;
 &amp;lt;array&amp;gt;&lt;br /&gt;
      &amp;lt;string&amp;gt;curl&amp;lt;/string&amp;gt;&lt;br /&gt;
      &amp;lt;string&amp;gt;-s&amp;lt;/string&amp;gt;&lt;br /&gt;
      &amp;lt;string&amp;gt;http://your-server-address/moodle19/admin/cron.php&amp;lt;/string&amp;gt;&lt;br /&gt;
 &amp;lt;/array&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;RunAtLoad&amp;lt;/key&amp;gt;&amp;lt;true /&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;StartInterval&amp;lt;/key&amp;gt;&amp;lt;integer&amp;gt;300&amp;lt;/integer&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;StandardErrorPath&amp;lt;/key&amp;gt;&amp;lt;string&amp;gt;/dev/null&amp;lt;/string&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;StandardOutPath&amp;lt;/key&amp;gt;&amp;lt;string&amp;gt;/dev/null&amp;lt;/string&amp;gt;&lt;br /&gt;
 &amp;lt;/dict&amp;gt;&lt;br /&gt;
 &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The label string must be the same as the file name is but without the extension &#039;&#039;.plist&#039;&#039;. Save the text file &#039;&#039;/Library/LaunchDaemons/moodle4mac.cron.plist&#039;&#039;. The owner of the file must be set to the system user &#039;&#039;root&#039;&#039;. That&#039;s all, really!&lt;br /&gt;
&lt;br /&gt;
===How to start and stop the cron service===&lt;br /&gt;
You can start the new cron service in the Terminal.&lt;br /&gt;
&lt;br /&gt;
 sudo launchctl load /Library/LaunchDaemons/moodle4mac.cron.plist&lt;br /&gt;
&lt;br /&gt;
The following command would stop the service. If you want to activate changes in the cron service you need to &#039;&#039;unload&#039;&#039; and then to &#039;&#039;load&#039;&#039; the daemon again.&lt;br /&gt;
&lt;br /&gt;
 sudo launchctl unload /Library/LaunchDaemons/moodle4mac.cron.plist&lt;br /&gt;
&lt;br /&gt;
===Only one service for two servers?===&lt;br /&gt;
For my server I needed to have a cron service for to instances &#039;&#039;moodle19&#039;&#039; and &#039;&#039;moodle20&#039;&#039; ... no problem ... with the typo &#039;&#039;moodle[19-20]&#039;&#039; I will get a cron service for both.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;curl -s http://your-server-address/moodle[19-20]/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if the cron service works correctly you should look at the &#039;&#039;access.log&#039;&#039; of your web server. The cron.php should be accessed every 5 minutes ... on my server for both Moodle instances &#039;&#039;moodle19&#039;&#039; and &#039;&#039;moodle20&#039;&#039; ... oh yes, it works!!&lt;br /&gt;
&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:10:56 +0200] &amp;quot;GET /moodle19/admin/cron.php HTTP/1.1&amp;quot; 200 1136&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:10:57 +0200] &amp;quot;GET /moodle20/admin/cron.php HTTP/1.1&amp;quot; 200 1403&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:11:18 +0200] &amp;quot;OPTIONS * HTTP/1.0&amp;quot; 200 -&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:15:56 +0200] &amp;quot;GET /moodle19/admin/cron.php HTTP/1.1&amp;quot; 200 735&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:15:57 +0200] &amp;quot;GET /moodle20/admin/cron.php HTTP/1.1&amp;quot; 200 964&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:20:56 +0200] &amp;quot;GET /moodle19/admin/cron.php HTTP/1.1&amp;quot; 200 1136&lt;br /&gt;
 192.168.0.220 - - [30/Jul/2009:22:20:57 +0200] &amp;quot;GET /moodle20/admin/cron.php HTTP/1.1&amp;quot; 200 1365&lt;br /&gt;
&lt;br /&gt;
==Managing cron on web hosting services==&lt;br /&gt;
&lt;br /&gt;
Your web-based control panel may have a web page that allows you to set up a cron service process. &lt;br /&gt;
&lt;br /&gt;
===CPanel cron service===&lt;br /&gt;
If you are using CPanel, login then look for &amp;quot;Advanced&amp;quot; category towards the bottom of the page. Click on Cron Jobs -&amp;gt; Advanced (Unix style). Enter the following for the cron to run every 30 minutes.&lt;br /&gt;
&lt;br /&gt;
 Email address for output: emailaddress@mydomain.con&lt;br /&gt;
 Minute:*/30&lt;br /&gt;
 Hour:*&lt;br /&gt;
 Day:*&lt;br /&gt;
 Month:*&lt;br /&gt;
 Weekday:* &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Command: wget -q -O /dev/null http://www.mydomain.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click Commit Changes. Check your email for the output. &lt;br /&gt;
&lt;br /&gt;
[[Image:Cpanel-cron-setup.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Other systems cron service===&lt;br /&gt;
For other systems, look for a button called &amp;quot;Cron jobs&amp;quot;. In there you can put the same sort of Unix commands as listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have permissions to run the &#039;wget&#039; command on the server, you can use this php command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/php -q /real/path/to/script/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
For example: &lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/php -q /home/username/public_html/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t know what is the real path of your Moodle folder you can use the PHP command realpath.&lt;br /&gt;
&lt;br /&gt;
Another alternative, if you do not have permission to run the &#039;wget&#039; command, may be to use a curl command.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
curl --silent --compressed http://mydomain.com/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
==Using a cron command line in Unix==&lt;br /&gt;
&lt;br /&gt;
There are different command line programs you can use to call the page from the command line. Not all of them may be available on a given server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The examples with wget, lynx, and similar are &#039;&#039;&#039;not&#039;&#039;&#039; the same as the &amp;quot;CLI only&amp;quot; cron checkbox, mentioned above (the configuration variable &amp;quot;cronclionly&amp;quot;). wget, lynx, and other similar utilities are Unix command-line HTTP clients, and thus running cron.php in this way is the same as running it in a browser, from Moodle&#039;s point of view.&lt;br /&gt;
&lt;br /&gt;
For example, you can use a Unix utility like &#039;wget&#039;:&lt;br /&gt;
&lt;br /&gt;
 wget -q -O /dev/null &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in this example that the output is thrown away (to /dev/null).&lt;br /&gt;
&lt;br /&gt;
A number of users of Moodle have found that &#039;wget&#039; sometimes fails. Especially if you have trouble with email digests not being sent on a daily basis to all users, an alternative command that solves the problem is:&lt;br /&gt;
&lt;br /&gt;
 php &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same thing using lynx:&lt;br /&gt;
&lt;br /&gt;
 lynx -dump &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt; &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
Note in this example that the output is thrown away (to /dev/null).&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can use a standalone version of PHP, compiled to be run on the command line. The disadvantage is that you need to have access to a command-line version of php. The advantage is that your web server logs aren&#039;t filled with constant requests to cron.php and you can run at a lower I/O and CPU priority.&lt;br /&gt;
&lt;br /&gt;
 /opt/bin/php /web/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
Example command to run at lower priority:&lt;br /&gt;
&lt;br /&gt;
  ionice -c3 -p$$;nice -n 10 /usr/bin/php /moodle/admin/cron.php &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
===Using the crontab program on Unix===&lt;br /&gt;
&lt;br /&gt;
All that Cpanel does is provide a web interface to a Unix utility known as crontab. If you have a command line, you can set up crontab yourself using the command:&lt;br /&gt;
&lt;br /&gt;
 crontab -e&lt;br /&gt;
&lt;br /&gt;
and then adding one of the above commands like:&lt;br /&gt;
&lt;br /&gt;
 */30 * * * * wget -q -O /dev/null &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first five entries are the times to run values, followed by the command to run. The asterisk is a wildcard, indicating any time. The above example means run the command &#039;&#039;wget -q -O /dev/null...&#039;&#039; every 30 minutes (*/30), every hour (*), every day of the month (*), every month (*), every day of the week (*). &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;O&amp;quot; of &amp;quot;-O&amp;quot; is the capital letter not zero, and refers the output file destination, in this case &amp;quot;/dev/null&amp;quot; which is a black hole and discards the output. If you want to see the output of your cron.php then enter its url in your browser. &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;
For &#039;&#039;&#039;beginners&#039;&#039;&#039;, &amp;quot;EDITOR=nano crontab -e&amp;quot; will allow you to edit the crontab using the [http://www.nano-editor.org/dist/v1.2/faq.html nano] editor. Ubuntu defaults to using the nano editor.&lt;br /&gt;
&lt;br /&gt;
Usually, the &amp;quot;crontab -e&amp;quot; command will put you into the &#039;vi&#039; editor. You enter &amp;quot;insert mode&amp;quot; by pressing &amp;quot;i&amp;quot;, then type in the line as above, then exit insert mode by pressing ESC. You save and exit by typing &amp;quot;:wq&amp;quot;, or quit without saving using &amp;quot;:q!&amp;quot; (without the quotes). Here is an [http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html intro] to the &#039;vi&#039; editor.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=41827 Cron - can someone give me a quick confirmation of function?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97684 Cronjob Question]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97457 Slow cron : avoiding simultaneous cron]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=117168 Visibility of cron.php]&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;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Cron]]&lt;br /&gt;
[[fr:Cron]]&lt;br /&gt;
[[nl:Cron]]&lt;br /&gt;
[[sk:Cron]]&lt;br /&gt;
[[pl:Cron]]&lt;br /&gt;
[[ja:Cron]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=77009</id>
		<title>Development:Developer documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=77009"/>
		<updated>2010-10-23T06:40:02Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Core components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:moodle-development-logo.jpg|right|400px]]&lt;br /&gt;
&lt;br /&gt;
This [[:Category:Developer|Developer]] section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.&lt;br /&gt;
&lt;br /&gt;
* If you manage a Moodle site, [[Administrator documentation]] may suit your needs better. &lt;br /&gt;
* If you teach using Moodle, try [[Teacher documentation]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; New developer documentation pages should be added to the &#039;&#039;Development namespace&#039;&#039; by typing &amp;lt;code&amp;gt;Development:&amp;lt;/code&amp;gt; before the new page name i.e. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Development:New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page may be added to the Developer category by adding the template &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{CategoryDeveloper}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to the bottom of the page. - If required, you can use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Developer|Sort key]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to provide a sort key other than the default page name.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How Moodle development works==&lt;br /&gt;
&lt;br /&gt;
The [[Development:Overview|overview of the Moodle development process]] explains how Moodle development occurs and how people become Moodle developers. Current plans are listed on the [[Roadmap]].&lt;br /&gt;
&lt;br /&gt;
You can also enrol in one of the [http://dev.moodle.org Moodle Developer Courses].&lt;br /&gt;
&lt;br /&gt;
==Guidelines==&lt;br /&gt;
&lt;br /&gt;
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:&lt;br /&gt;
*[[Development:Coding|Coding guidelines]] have to be followed by all Moodle developers&lt;br /&gt;
*[[Moodle design goals]] spells out the basic design goals behind Moodle&lt;br /&gt;
*[[CVS (developer)|Moodle CVS for developers]] explains how to work with the Moodle code in CVS&lt;br /&gt;
*[[Tracker]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc&lt;br /&gt;
*[[Development:Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes&lt;br /&gt;
*[[Development:Unit tests|Unit tests]] explains how to run the unit tests, and how to write new test cases.&lt;br /&gt;
*[[Development:Fast portable SQL]] shows SQL techniques that are fast, efficient, and known to work on all supported DBs.&lt;br /&gt;
*[[Development:Development hints and tips]] a (developing) list of general wisdom to help with your Moodle projects.&lt;br /&gt;
&lt;br /&gt;
==Documentation for core components==&lt;br /&gt;
&lt;br /&gt;
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the [[Development:Developer notes|developer notes]] or on the [[Roadmap|roadmap]].&lt;br /&gt;
&lt;br /&gt;
The documents below give a general overview. For detailed function-by-function documentation, see the [http://phpdocs.moodle.org/ phpDocumentor] documentation that is automatically generated from the comments in the code. &lt;br /&gt;
&lt;br /&gt;
And don&#039;t forget that the most up-to-date and detailed description of how the code works is the code itself, and you can [http://xref.moodle.org/nav.html?index.html browse the code online] using [[Development:PHPXref|PHPXref]].&lt;br /&gt;
&lt;br /&gt;
===Getting started===&lt;br /&gt;
&lt;br /&gt;
* (2-3 getting started links here)&lt;br /&gt;
&lt;br /&gt;
===Core components ===&lt;br /&gt;
&lt;br /&gt;
*[[Development:XMLDB_Documentation|Database abstraction layer]] @ v[[1.7]]&lt;br /&gt;
*[[Development:Roles|Roles and Capabilities system]] @ v[[1.7]] for controlling who can do what&lt;br /&gt;
*[[Development:lib/formslib.php|Forms library]] @ v[[1.8]] for creating accessible and secure HTML forms that let users edit things&lt;br /&gt;
*[[Development:Using_the_file_API|File API]] @ v[[2.0]] for managing files stored by Moodle&lt;br /&gt;
*[[Development:Database schema introduction|The database schema]]&lt;br /&gt;
*[[Development:What happens when you require config.php|What happens when you require config.php]]&lt;br /&gt;
*[[Development:lib/moodlelib.php|lib/moodlelib.php]]&lt;br /&gt;
*[[Development:lib/weblib.php|lib/weblib.php]] for outputting stuff&lt;br /&gt;
&lt;br /&gt;
===Core libraries with a more specific uses===&lt;br /&gt;
&lt;br /&gt;
*[[Authentication API]]&lt;br /&gt;
*[[Cookieless Sessions]]&lt;br /&gt;
*[[Email processing]]&lt;br /&gt;
*[[Development:Environment checking|Environment checking]] before install, check the user&#039;s server to ensure Moodle will work there.&lt;br /&gt;
*[[Development:Groups|Groups system]]&lt;br /&gt;
*[[Development:Grades|Gradebook]]&lt;br /&gt;
*[[Development:Moodle Network|Moodle Network]]&lt;br /&gt;
*[[Question engine]]&lt;br /&gt;
*[[Stats package]]&lt;br /&gt;
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]&lt;br /&gt;
*[http://developer.yahoo.com/yui YUI JavaScript library] - YUI was selected as the official AJAX library for Moodle.&lt;br /&gt;
*[[Development:lib/graphlib|lib/graphlib]]&lt;br /&gt;
*[[Development:Admin settings|Admin settings]]&lt;br /&gt;
&lt;br /&gt;
===Modules included in the standard distribution===&lt;br /&gt;
&lt;br /&gt;
*[[Development:Lesson Specification|Lesson Specification]]&lt;br /&gt;
*[[Quiz developer docs|Quiz module]]&lt;br /&gt;
*[[SCORM schema|SCORM module 1.5 schema]]&lt;br /&gt;
&lt;br /&gt;
==How you can contribute==&lt;br /&gt;
&lt;br /&gt;
===Make a new plugin===&lt;br /&gt;
&lt;br /&gt;
The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. There are many types of plugin you can write:&lt;br /&gt;
*[[Development:Modules|Activity modules]], see also [[Development:NEWMODULE Documentation]] (work in progress)&lt;br /&gt;
*[[Development:Admin reports|Admin reports]]&lt;br /&gt;
*[[Development:Assignment types|Assignment types]]&lt;br /&gt;
*[[Development:Authentication plugins|Authentication plugins]]&lt;br /&gt;
*[[Development:Blocks|Blocks]]&lt;br /&gt;
*Content editors (2.0 onwards)&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Development:Course Report Plugins|Course reports]]&lt;br /&gt;
*Course importers (2.0 onwards)&lt;br /&gt;
*[[Development:Database fields|Database fields]]&lt;br /&gt;
*[[Development:Database presets|Database presets]]&lt;br /&gt;
*[[Development:Enrolment plugins|Enrolment plugins]]&lt;br /&gt;
*[[Development:Filters|Filters]]&lt;br /&gt;
*[[Development:Gradebook_Report_Tutorial|Gradebook report]]&lt;br /&gt;
*[[Development:Gradebook export|Gradebook export]]&lt;br /&gt;
*[[Development:Gradebook import|Gradebook import]]&lt;br /&gt;
*Message senders (2.0 onwards)&lt;br /&gt;
*Mnet services&lt;br /&gt;
*Plagiarism detection plugins (2.0 onwards)&lt;br /&gt;
*[[Development:Writing_a_Portfolio_Plugin|Portfolio plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Question_type_plugin_how_to|Question types]]&lt;br /&gt;
*[[Development:Question import/export formats|Question import/export formats]]&lt;br /&gt;
*[[Development:How to write a quiz report plugin|Quiz reports]]&lt;br /&gt;
*[[Development:Repository plugins|Repository plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Resource types|Resource types]]&lt;br /&gt;
*[[Development:Search engine adapters|Search engine adapters]]&lt;br /&gt;
*Themes which are different in [[Development:Themes_2.0|Moodle 2.0]], and [[Theme_basics|earlier versions]].&lt;br /&gt;
*User profile fields&lt;br /&gt;
*Web services (2.0 onwards)&lt;br /&gt;
*Workshop allocators (2.0 onwards)&lt;br /&gt;
*Workshop forms (2.0 onwards)&lt;br /&gt;
*Workshop evaluators (2.0 onwards)&lt;br /&gt;
&lt;br /&gt;
General information that applies to all types of plugins&lt;br /&gt;
*[[Development:Places to search for lang strings|Where to put language strings for your plugin]]&lt;br /&gt;
*[[Development:Installing and upgrading plugin database tables|Defining the database tables for your plugin]]&lt;br /&gt;
&lt;br /&gt;
Please see the [[Development:Guidelines for contributed code|Guidelines for contributed code]] for an overview of how to contribute to the Moodle code.&lt;br /&gt;
&lt;br /&gt;
Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the [[Development:Local_customisation|local customisations]] hook.&lt;br /&gt;
&lt;br /&gt;
===Change core code===&lt;br /&gt;
&lt;br /&gt;
Some types of change can only be made by editing the core Moodle code. Such changes are much harder to maintain than plugins. If you want your core change to be considered for inclusion in the official Moodle release, you need to create an issue in the [[Tracker|tracker]], and attach your change as a [[Development:How_to_create_a_patch|patch]]. It is also a good idea to discuss your ideas in the forums first.  See [[Development:Overview#Major_Development]] for more details.&lt;br /&gt;
&lt;br /&gt;
===Ways to contribute that do not involve PHP programming===&lt;br /&gt;
&lt;br /&gt;
*[[Themes|Create Moodle themes]]&lt;br /&gt;
*[[Translation|Translate Moodle into other languages]]&lt;br /&gt;
*[[MoodleDocs:Guidelines for contributors|Help document Moodle]]&lt;br /&gt;
*[[Development:Tests|Join the testing effort]], which involves [[Tracker|participating in the bug tracker]]&lt;br /&gt;
&lt;br /&gt;
==Plans for the future==&lt;br /&gt;
&lt;br /&gt;
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.&lt;br /&gt;
&lt;br /&gt;
Once ideas begin to crystallize on the forums they can be summarized in this wiki, either as part of the [[Roadmap|roadmap]] or in the form of [[Development:Developer notes|developer notes]]. These pages then form the basis for further discussion in the forums.&lt;br /&gt;
&lt;br /&gt;
*[[Roadmap]]&lt;br /&gt;
*[[Development:Developer notes|Developer notes]]&lt;br /&gt;
*[[Student projects]]&lt;br /&gt;
*[[Developer meetings]]&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
*[[Developer FAQ]] - frequently asked questions, especially useful for newcomers to Moodle&lt;br /&gt;
*[[Development:Finding_your_way_into_the_Moodle_code|Finding your way into the Moodle code]] - also aimed at newcomers&lt;br /&gt;
*[http://tracker.moodle.org/ Moodle tracker] - bug reports, feature requests and other tracked issues&lt;br /&gt;
**[[Firefox tracker search]] - How to setup a firefox quicksearch to easily navigate to moodle bugs&lt;br /&gt;
**[[Firefox tracker search#Firefox Search Plugins|Firefox Search Plugins]] - Find tracked issues even more easily&lt;br /&gt;
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to [[HEAD]]&lt;br /&gt;
*Browse the code online:&lt;br /&gt;
**[http://cvs.moodle.org/moodle/ the code with a complete change history from CVS]&lt;br /&gt;
**[http://xref.moodle.org/index.html the code, with links generated by PHPXref]&lt;br /&gt;
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - compiled nightly from the comment attached to each class and function in the code.  &lt;br /&gt;
*[[Development:Database Schema|Database Schema]] - for recent releases&lt;br /&gt;
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course&lt;br /&gt;
**especially the [http://moodle.org/mod/forum/view.php?id=55 General developer forum]&lt;br /&gt;
**[[Filters used on the Moodle.org forums|cool tricks you can use in the moodle.org forums]]&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
Some tools people use when working on Moodle code:&lt;br /&gt;
&lt;br /&gt;
=== IDEs ===&lt;br /&gt;
&lt;br /&gt;
* [[Development:Setting_up_Netbeans|Setting up NetBeans for Moodle development]] - NetBeans for PHP is a great out-of-the-box editor.&lt;br /&gt;
* [[Development:Setting_up_Eclipse|Setting up Eclipse for Moodle development]] - Eclipse is a great editor to use for php development, if you can work out how to set it up.&lt;br /&gt;
* [[Development:vim|Setting up Vim for Moodle development]]&lt;br /&gt;
* [http://www.aptana.com/ Aptana Studio 2]&lt;br /&gt;
&lt;br /&gt;
=== Browser add-ons ===&lt;br /&gt;
*[http://getfirebug.com Firebug], see [[Development:Firebug]].&lt;br /&gt;
* [[Web developer extension]]&lt;br /&gt;
* [https://addons.mozilla.org/en-US/firefox/addon/394 ViewSourceWith] - The main goal is to view page source with external applications, but you can do a lot of other things as well.&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous === &lt;br /&gt;
*[[Development:ctags|Ctags]] - Using a tags file to navigate code&lt;br /&gt;
*[[W3C_validation|W3C HTML validator]] - Moodle has built in support to make using it easier.&lt;br /&gt;
*[[Development:Windows Installer|Windows Installer]] - Windows Installer documentation for developer.&lt;br /&gt;
&lt;br /&gt;
See also: [http://dev.moodle.org/mod/forum/view.php?id=18 Useful Development Tools forum]in the [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming course]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/security/ Moodle Security Announcements]&lt;br /&gt;
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Developer tools]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:Краткий обзор]]&lt;br /&gt;
[[es:Documentación para Desarrolladores]]&lt;br /&gt;
[[fr:Documentation développeur]]&lt;br /&gt;
[[pt:Desenvolvimento:Documentação para programadores]]&lt;br /&gt;
[[zh:开发者文档]]&lt;br /&gt;
[[ja:開発者ドキュメント]]&lt;br /&gt;
[[fi:Ohjelmoijan opas]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Interface_guidelines&amp;diff=77008</id>
		<title>Development:Interface guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Interface_guidelines&amp;diff=77008"/>
		<updated>2010-10-23T06:33:33Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Page layout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Work in progress}}&lt;br /&gt;
This document is not authoritative, it is a collection of ideas and under construction.&lt;br /&gt;
&lt;br /&gt;
==Keeping it simple==&lt;br /&gt;
&lt;br /&gt;
Use the minimum interface required to get the job done.&lt;br /&gt;
Order the elements by contexts. Give the user a strong orientation where the places are to do several things.&lt;br /&gt;
&lt;br /&gt;
==Standard pages==&lt;br /&gt;
&lt;br /&gt;
See [[Development:Address_Bar|Address Bar/URL UI guideline]]&lt;br /&gt;
&lt;br /&gt;
==One script per major function/page==&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
==Page layout==&lt;br /&gt;
See: [[Development:Page_structure_and_types#Implementation|Basic page _structure UI guideline]]&lt;br /&gt;
&lt;br /&gt;
==Form layout==&lt;br /&gt;
&lt;br /&gt;
See: [[Development:Form|Form UI guideline]] &lt;br /&gt;
&lt;br /&gt;
==Dealing with tables==&lt;br /&gt;
&lt;br /&gt;
Use the print_table function whenever possible.&lt;br /&gt;
&lt;br /&gt;
==Standard navigation tools==&lt;br /&gt;
&lt;br /&gt;
See: &lt;br /&gt;
* [[Development:Page_structure_and_types#Basic_page_structure|Basic page structure UI guideline]]&lt;br /&gt;
* [[Development:Link|Link UI guideline]]&lt;br /&gt;
* [[Development:Button|Button UI guideline]]&lt;br /&gt;
&lt;br /&gt;
The information that was here has been incorporated to those pages&lt;br /&gt;
&lt;br /&gt;
==URLs==&lt;br /&gt;
See [[Development:Address_Bar|Address Bar UI guideline]]&lt;br /&gt;
&lt;br /&gt;
==Buttons vs links==&lt;br /&gt;
&lt;br /&gt;
See: [[Development:Button]] and [[Development:Link]] UI guidelines.&lt;br /&gt;
&lt;br /&gt;
The information that was here has been integrated to those documents.&lt;br /&gt;
&lt;br /&gt;
==Language strings==&lt;br /&gt;
&lt;br /&gt;
# Use your own language strings in a separate file. Don&#039;t use existing language files from moodle.php or other lang files. So translators can translate in the contexts in different ways as terms are used in the special learning culture.&lt;br /&gt;
&lt;br /&gt;
==CSS naming==&lt;br /&gt;
&lt;br /&gt;
* Don&#039;t add font, color or layout definitions in code. This belongs to CSS theme files.&lt;br /&gt;
* See [[Standards|theme standards]]&lt;br /&gt;
&lt;br /&gt;
==Linking to help==&lt;br /&gt;
&lt;br /&gt;
* Help buttons should be on the right of the thing (as an exception it can be left, if the thing is right-aligned)&lt;br /&gt;
&lt;br /&gt;
==Related topics==&lt;br /&gt;
&lt;br /&gt;
Robin Good&#039;s Latest News. &amp;quot;Interaction Design Meets Online Real Estate&amp;quot; 1 Mar. 2005 http://www.masternewmedia.org/news/2005/03/01/interaction_design_meets_online_real.htm&lt;br /&gt;
&lt;br /&gt;
The article presents a view of virtual spaces with the focus on human actions. It reminded me of communicative approaches like Moodle. The interface serves as the handle of all the communication tools.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:Usability]]&lt;br /&gt;
* [[Development:Moodle_User_Interface_Guidelines|Moodle User Interface Guidelines]] GSOC 2009 project&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding guidelines|Interface]]&lt;br /&gt;
[[Category:Moodle User Interface Guidelines]]&lt;br /&gt;
&lt;br /&gt;
[[pt:Guia para interface]]&lt;br /&gt;
[[es:Manual de estilo de la interfaz]]&lt;br /&gt;
[[ja:インターフェースガイドライン]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Quiz_reports&amp;diff=77007</id>
		<title>Quiz reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Quiz_reports&amp;diff=77007"/>
		<updated>2010-10-23T06:32:02Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Overview list settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quizzes}}&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;Quiz report&#039;&#039;&#039; is shown under the quiz &#039;&#039;&#039;Results&#039;&#039;&#039; tab as secondary tabs, one for each report, plus a regrade and manual grading tabs. The number of subtabs shown, depends on the number of [http://moodle.org/mod/data/view.php?d=13&amp;amp;perpage=10&amp;amp;search=Quiz+report&amp;amp;sort=46&amp;amp;order=ASC report plugins] your Moodle administrator has installed. &lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results overview tab.JPG|Center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The overview sub tab has some options to display lists of students who have taken the quiz. The list is displayed in this subtab. &lt;br /&gt;
&lt;br /&gt;
===View of list===&lt;br /&gt;
The list of quiz attempts arranged in four columns:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;First name / Surname&#039;&#039;&#039; &lt;br /&gt;
# &#039;&#039;&#039;Started on&#039;&#039;&#039; - that contains the information about the exact time the test was started&lt;br /&gt;
# &#039;&#039;&#039;Time taken&#039;&#039;&#039; - the amount of time it took a given student to do the test&lt;br /&gt;
# &#039;&#039;&#039;Grade/x&#039;&#039;&#039; - the number of points students scored; &#039;x&#039; is the maximum number of points students could score&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results overview List.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Download lists===&lt;br /&gt;
There are three buttons to download the list of students with quiz results. The teacher may select specific student attempts or select all.&lt;br /&gt;
&lt;br /&gt;
===Overview list settings===&lt;br /&gt;
&lt;br /&gt;
The default view lists only the students who attempted the test. You can, however, change the display settings checking either of the two boxes (followed by clicking Go): &lt;br /&gt;
[[Image:Quiz overview report preferences.png|thumb|400px|Overview report preferences in 1.9]]&lt;br /&gt;
# &#039;&#039;&#039;Which users to include - there are four options available:&lt;br /&gt;
#* Show Students with attempts only - list only the students on the course who have done test&lt;br /&gt;
#* Show Students with no attempts only - list students who have not yet attempted the quiz&lt;br /&gt;
#* Show all Students - list all the students on the course no matter if they did the test or not&lt;br /&gt;
#* Show all attempts - like &#039;Show Students with attempts only&#039;, but this also includes attempts by users who used to be students on the course, but have since been unenrolled.&lt;br /&gt;
# &#039;&#039;&#039;Show mark details&#039;&#039;&#039; - this extends the list with as many columns as there are questions in the test; each column is headed by &#039;n&#039; (where &#039;n&#039; stands for the question number) &lt;br /&gt;
&lt;br /&gt;
With the Select all / Deselect all options you can check / uncheck all the names in the list, and, with selected, delete.&lt;br /&gt;
&lt;br /&gt;
To sort the results by two columns, first click on the column heading you want to be the &#039;&#039;&#039;&#039;&#039;second&#039;&#039;&#039;&#039;&#039; key, and then click on the column heading you want to be the &#039;&#039;&#039;&#039;&#039;primary&#039;&#039;&#039;&#039;&#039; key.&lt;br /&gt;
&lt;br /&gt;
{{Moodle 1.9}}In Moodle 1.9 onwards, you can set the number of rows displayed on each page of the overview report.&lt;br /&gt;
&lt;br /&gt;
==Regrade==&lt;br /&gt;
&lt;br /&gt;
That tab will recalculate the quiz grades. This may become necessary if you have changed  one of the questions or the grade possible for the quiz or a question.&lt;br /&gt;
&lt;br /&gt;
==Manual grading==&lt;br /&gt;
&lt;br /&gt;
The grade of any question in a quiz can be manually overridden, and a comment added. A teacher can do this from the review page. There are also some question types that Moodle does not grade automatically (at the moment only the Essay question). This report helps you grade questions of these types by listing just the questions that still need to be graded.&lt;br /&gt;
&lt;br /&gt;
==Item analysis==&lt;br /&gt;
&lt;br /&gt;
This tab presents processed quiz data in a table, suitable for analyzing and judging the performance of each question for the function of assessment. The statistical parameters used are defined in the help link next &amp;quot;Item Analysis Table&amp;quot; header, or in the help file \moodle\lang\en_utf8\help\quiz\itemanalysis.html&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results ItemAnalysis example.JPG]]&lt;br /&gt;
===Analysis columns===&lt;br /&gt;
* &#039;&#039;&#039;Q#&#039;&#039;&#039; - shows the question id number, icon type and a preview popup window link that has an edit link embedded in it.&lt;br /&gt;
* &#039;&#039;&#039;Question Text&#039;&#039;&#039; - the question&lt;br /&gt;
* &#039;&#039;&#039;Answer text&#039;&#039;&#039; - each answer&lt;br /&gt;
* &#039;&#039;&#039;Partial credit&#039;&#039;&#039; - how much credit was given by teacher for each answer&lt;br /&gt;
* &#039;&#039;&#039;R counts&#039;&#039;&#039; - how many selected the answer and the total attempts&lt;br /&gt;
* &#039;&#039;&#039;% R&#039;&#039;&#039; - the percentage that selected that answer&lt;br /&gt;
* &#039;&#039;&#039;Facility Index (% Correct)&#039;&#039;&#039; - the overall difficulty of the question  &lt;br /&gt;
* &#039;&#039;&#039;Standard Deviation (SD)&#039;&#039;&#039; - measure of variation of selected answers&lt;br /&gt;
* &#039;&#039;&#039;DI &amp;amp; DC columns&#039;&#039;&#039; - Question effectiveness measures&lt;br /&gt;
&lt;br /&gt;
===Descriptions defined===&lt;br /&gt;
* &#039;&#039;&#039;Facility Index (% Correct)&#039;&#039;&#039; - The overall difficulty of the questions.&lt;br /&gt;
 FI = (Xaverage) / Xmax &lt;br /&gt;
where Xaverage is the mean credit obtained by all users attempting the item, and Xmax is the maximum credit achievable for that item. If questions can be distributed dicotomically into correct / incorrect categories, this parameter coincides with the percentage of users that answer the question correctly. &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Standard Deviation (SD)&#039;&#039;&#039; - The range of responses&lt;br /&gt;
&lt;br /&gt;
This parameter measures the spread of answers in the response population. If all users answers the same, then SD=0. SD is calculated as the statistical standard deviation for the sample of fractional scores (achieved/maximum) at each particular question. &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DI &amp;amp; DC columns&#039;&#039;&#039; - Effectiveness measures&lt;br /&gt;
Both DC and DI can be used as powerful methods of evaluating the effectiveness of the quiz when assessing differentiation of learners. The advantage of using Discrimination Coefficient as opposed to Discrimination Index is that the former uses information from the whole population of learners, not just the extreme upper and lower thirds. Thus, this parameter may be more sensitive to detect item performance.&lt;br /&gt;
&lt;br /&gt;
** &#039;&#039;&#039;Discrimination Index (DI)&#039;&#039;&#039; &lt;br /&gt;
This provides a rough indicator of the performance of each item to separate high scores vs. scorers. This parameter is calculated by first dividing learners into thirds based on the overall score in the quiz. Then the average score at the analysed item is calculated for the groups of top and bottom performers, and the average scored subtracted. The mathematical expression is: &lt;br /&gt;
 DI = (Xtop - Xbottom)/ N &lt;br /&gt;
where Xtop is the sum of the fractional credit (achieved/maximum) obtained at this item by the 1/3 of users having the highest grades in the whole quiz (i.e. number of correct responses in this group), and Xbottom is the analog sum for users with the lower 1/3 grades for the whole quiz.&lt;br /&gt;
&lt;br /&gt;
This parameter can take values between +1 and -1. If the index goes below 0.0 it means that more of the weaker learners got the item right than the stronger learners. Such items should be discarded as worthless. In fact, they reduce the accuracy of the overall score for the quiz. &lt;br /&gt;
&lt;br /&gt;
** &#039;&#039;&#039;Discrimination Coefficient (DC)&#039;&#039;&#039; - &lt;br /&gt;
&lt;br /&gt;
This is another measure of the separating power of the item to distinguish proficient from weak learners.&lt;br /&gt;
The discrimination coefficient is a correlation coefficient between scores at the item and at the whole quiz. Here it is calculated as: &lt;br /&gt;
 DC = Sum(xy)/ (N * sx * sy) &lt;br /&gt;
where Sum(xy) is the sum of the products of deviations for item scores and overall quiz scores, &lt;br /&gt;
N is the number of responses given to this question,&lt;br /&gt;
sx is the standard deviation of fractional scores for this question and, &lt;br /&gt;
sy is the standard deviation of scores at the quiz as a whole. &lt;br /&gt;
&lt;br /&gt;
Again, this parameter can take values between +1 and -1. Positive values indicate items that do discriminate proficient learners, whereas negative indices mark items that are answered best by those with lowest grades. Items with negative DC are answered incorrectly by the seasoned learners and thus they are actually a penalty against the most proficient learners. Those items should be avoided.&lt;br /&gt;
&lt;br /&gt;
==Delete selected attempts==&lt;br /&gt;
This is one of the buttons below the grades.  This allows you to delete an attempt by a student who has mistakenly used up an attempt when the quiz is set to allow only 1 attempt or so.&lt;br /&gt;
&lt;br /&gt;
A related discussion is here:&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=62972&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Detailed responses report plugin]]&lt;br /&gt;
*[[Item analysis theoretical background]]&lt;br /&gt;
&lt;br /&gt;
[[de:Test-Berichte]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Quiz_reports&amp;diff=77006</id>
		<title>Quiz reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Quiz_reports&amp;diff=77006"/>
		<updated>2010-10-23T06:31:10Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quizzes}}&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;Quiz report&#039;&#039;&#039; is shown under the quiz &#039;&#039;&#039;Results&#039;&#039;&#039; tab as secondary tabs, one for each report, plus a regrade and manual grading tabs. The number of subtabs shown, depends on the number of [http://moodle.org/mod/data/view.php?d=13&amp;amp;perpage=10&amp;amp;search=Quiz+report&amp;amp;sort=46&amp;amp;order=ASC report plugins] your Moodle administrator has installed. &lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results overview tab.JPG|Center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The overview sub tab has some options to display lists of students who have taken the quiz. The list is displayed in this subtab. &lt;br /&gt;
&lt;br /&gt;
===View of list===&lt;br /&gt;
The list of quiz attempts arranged in four columns:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;First name / Surname&#039;&#039;&#039; &lt;br /&gt;
# &#039;&#039;&#039;Started on&#039;&#039;&#039; - that contains the information about the exact time the test was started&lt;br /&gt;
# &#039;&#039;&#039;Time taken&#039;&#039;&#039; - the amount of time it took a given student to do the test&lt;br /&gt;
# &#039;&#039;&#039;Grade/x&#039;&#039;&#039; - the number of points students scored; &#039;x&#039; is the maximum number of points students could score&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results overview List.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Download lists===&lt;br /&gt;
There are three buttons to download the list of students with quiz results. The teacher may select specific student attempts or select all.&lt;br /&gt;
&lt;br /&gt;
===Overview list settings===&lt;br /&gt;
&lt;br /&gt;
The default view lists only the students who attempted the test. You can, however, change the display settings checking either of the two boxes (followed by clicking Go): &lt;br /&gt;
[[Image:Quiz overview report preferences.png|thumb|Overview report preferences in 1.9]]&lt;br /&gt;
# &#039;&#039;&#039;Which users to include - there are four options available:&lt;br /&gt;
#* Show Students with attempts only - list only the students on the course who have done test&lt;br /&gt;
#* Show Students with no attempts only - list students who have not yet attempted the quiz&lt;br /&gt;
#* Show all Students - list all the students on the course no matter if they did the test or not&lt;br /&gt;
#* Show all attempts - like &#039;Show Students with attempts only&#039;, but this also includes attempts by users who used to be students on the course, but have since been unenrolled.&lt;br /&gt;
# &#039;&#039;&#039;Show mark details&#039;&#039;&#039; - this extends the list with as many columns as there are questions in the test; each column is headed by &#039;n&#039; (where &#039;n&#039; stands for the question number) &lt;br /&gt;
&lt;br /&gt;
With the Select all / Deselect all options you can check / uncheck all the names in the list, and, with selected, delete.&lt;br /&gt;
&lt;br /&gt;
To sort the results by two columns, first click on the column heading you want to be the &#039;&#039;&#039;&#039;&#039;second&#039;&#039;&#039;&#039;&#039; key, and then click on the column heading you want to be the &#039;&#039;&#039;&#039;&#039;primary&#039;&#039;&#039;&#039;&#039; key.&lt;br /&gt;
&lt;br /&gt;
{{Moodle 1.9}}In Moodle 1.9 onwards, you can set the number of rows displayed on each page of the overview report.&lt;br /&gt;
&lt;br /&gt;
==Regrade==&lt;br /&gt;
&lt;br /&gt;
That tab will recalculate the quiz grades. This may become necessary if you have changed  one of the questions or the grade possible for the quiz or a question.&lt;br /&gt;
&lt;br /&gt;
==Manual grading==&lt;br /&gt;
&lt;br /&gt;
The grade of any question in a quiz can be manually overridden, and a comment added. A teacher can do this from the review page. There are also some question types that Moodle does not grade automatically (at the moment only the Essay question). This report helps you grade questions of these types by listing just the questions that still need to be graded.&lt;br /&gt;
&lt;br /&gt;
==Item analysis==&lt;br /&gt;
&lt;br /&gt;
This tab presents processed quiz data in a table, suitable for analyzing and judging the performance of each question for the function of assessment. The statistical parameters used are defined in the help link next &amp;quot;Item Analysis Table&amp;quot; header, or in the help file \moodle\lang\en_utf8\help\quiz\itemanalysis.html&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz Results ItemAnalysis example.JPG]]&lt;br /&gt;
===Analysis columns===&lt;br /&gt;
* &#039;&#039;&#039;Q#&#039;&#039;&#039; - shows the question id number, icon type and a preview popup window link that has an edit link embedded in it.&lt;br /&gt;
* &#039;&#039;&#039;Question Text&#039;&#039;&#039; - the question&lt;br /&gt;
* &#039;&#039;&#039;Answer text&#039;&#039;&#039; - each answer&lt;br /&gt;
* &#039;&#039;&#039;Partial credit&#039;&#039;&#039; - how much credit was given by teacher for each answer&lt;br /&gt;
* &#039;&#039;&#039;R counts&#039;&#039;&#039; - how many selected the answer and the total attempts&lt;br /&gt;
* &#039;&#039;&#039;% R&#039;&#039;&#039; - the percentage that selected that answer&lt;br /&gt;
* &#039;&#039;&#039;Facility Index (% Correct)&#039;&#039;&#039; - the overall difficulty of the question  &lt;br /&gt;
* &#039;&#039;&#039;Standard Deviation (SD)&#039;&#039;&#039; - measure of variation of selected answers&lt;br /&gt;
* &#039;&#039;&#039;DI &amp;amp; DC columns&#039;&#039;&#039; - Question effectiveness measures&lt;br /&gt;
&lt;br /&gt;
===Descriptions defined===&lt;br /&gt;
* &#039;&#039;&#039;Facility Index (% Correct)&#039;&#039;&#039; - The overall difficulty of the questions.&lt;br /&gt;
 FI = (Xaverage) / Xmax &lt;br /&gt;
where Xaverage is the mean credit obtained by all users attempting the item, and Xmax is the maximum credit achievable for that item. If questions can be distributed dicotomically into correct / incorrect categories, this parameter coincides with the percentage of users that answer the question correctly. &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Standard Deviation (SD)&#039;&#039;&#039; - The range of responses&lt;br /&gt;
&lt;br /&gt;
This parameter measures the spread of answers in the response population. If all users answers the same, then SD=0. SD is calculated as the statistical standard deviation for the sample of fractional scores (achieved/maximum) at each particular question. &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DI &amp;amp; DC columns&#039;&#039;&#039; - Effectiveness measures&lt;br /&gt;
Both DC and DI can be used as powerful methods of evaluating the effectiveness of the quiz when assessing differentiation of learners. The advantage of using Discrimination Coefficient as opposed to Discrimination Index is that the former uses information from the whole population of learners, not just the extreme upper and lower thirds. Thus, this parameter may be more sensitive to detect item performance.&lt;br /&gt;
&lt;br /&gt;
** &#039;&#039;&#039;Discrimination Index (DI)&#039;&#039;&#039; &lt;br /&gt;
This provides a rough indicator of the performance of each item to separate high scores vs. scorers. This parameter is calculated by first dividing learners into thirds based on the overall score in the quiz. Then the average score at the analysed item is calculated for the groups of top and bottom performers, and the average scored subtracted. The mathematical expression is: &lt;br /&gt;
 DI = (Xtop - Xbottom)/ N &lt;br /&gt;
where Xtop is the sum of the fractional credit (achieved/maximum) obtained at this item by the 1/3 of users having the highest grades in the whole quiz (i.e. number of correct responses in this group), and Xbottom is the analog sum for users with the lower 1/3 grades for the whole quiz.&lt;br /&gt;
&lt;br /&gt;
This parameter can take values between +1 and -1. If the index goes below 0.0 it means that more of the weaker learners got the item right than the stronger learners. Such items should be discarded as worthless. In fact, they reduce the accuracy of the overall score for the quiz. &lt;br /&gt;
&lt;br /&gt;
** &#039;&#039;&#039;Discrimination Coefficient (DC)&#039;&#039;&#039; - &lt;br /&gt;
&lt;br /&gt;
This is another measure of the separating power of the item to distinguish proficient from weak learners.&lt;br /&gt;
The discrimination coefficient is a correlation coefficient between scores at the item and at the whole quiz. Here it is calculated as: &lt;br /&gt;
 DC = Sum(xy)/ (N * sx * sy) &lt;br /&gt;
where Sum(xy) is the sum of the products of deviations for item scores and overall quiz scores, &lt;br /&gt;
N is the number of responses given to this question,&lt;br /&gt;
sx is the standard deviation of fractional scores for this question and, &lt;br /&gt;
sy is the standard deviation of scores at the quiz as a whole. &lt;br /&gt;
&lt;br /&gt;
Again, this parameter can take values between +1 and -1. Positive values indicate items that do discriminate proficient learners, whereas negative indices mark items that are answered best by those with lowest grades. Items with negative DC are answered incorrectly by the seasoned learners and thus they are actually a penalty against the most proficient learners. Those items should be avoided.&lt;br /&gt;
&lt;br /&gt;
==Delete selected attempts==&lt;br /&gt;
This is one of the buttons below the grades.  This allows you to delete an attempt by a student who has mistakenly used up an attempt when the quiz is set to allow only 1 attempt or so.&lt;br /&gt;
&lt;br /&gt;
A related discussion is here:&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=62972&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Detailed responses report plugin]]&lt;br /&gt;
*[[Item analysis theoretical background]]&lt;br /&gt;
&lt;br /&gt;
[[de:Test-Berichte]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Plugins&amp;diff=77005</id>
		<title>Development:Plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Plugins&amp;diff=77005"/>
		<updated>2010-10-23T06:05:49Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. &lt;br /&gt;
&lt;br /&gt;
There are many &#039;&#039;&#039;types&#039;&#039;&#039; of plugin you can write:&lt;br /&gt;
&lt;br /&gt;
*[[Development:Modules|Activity modules]], see also [[Development:NEWMODULE Documentation]] (work in progress)&lt;br /&gt;
*[[Development:Admin reports|Admin reports]]&lt;br /&gt;
*[[Development:Assignment types|Assignment types]]&lt;br /&gt;
*[[Development:Authentication plugins|Authentication plugins]]&lt;br /&gt;
*[[Development:Blocks|Blocks]]&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Development:Course Report Plugins|Course reports]]&lt;br /&gt;
*[[Development:Database fields|Database fields]]&lt;br /&gt;
*[[Development:Database presets|Database presets]]&lt;br /&gt;
*[[Development:Enrolment plugins|Enrolment plugins]]&lt;br /&gt;
*[[Development:Filters|Filters]]&lt;br /&gt;
*[[Development:Gradebook plugins|Gradebook plugins]]&lt;br /&gt;
**[[Development:Gradebook_Report_Tutorial|Gradebook report]]&lt;br /&gt;
**[[Development:Gradebook export|Gradebook export]]&lt;br /&gt;
**[[Development:Gradebook import|Gradebook import]]&lt;br /&gt;
*[[Development:Writing_a_Portfolio_Plugin|Portfolio Plugins]]&lt;br /&gt;
*[[Development:Question_type_plugin_how_to|Question types]]&lt;br /&gt;
*[[Development:Question import/export formats|Question import/export formats]]&lt;br /&gt;
*[[Development:How to write a quiz report plugin|Quiz reports]]&lt;br /&gt;
*[[Development:Repository plugins|Repository plugins]]&lt;br /&gt;
*[[Development:Resource types|Resource types]]&lt;br /&gt;
*[[Development:Search engine adapters|Search engine adapters]]&lt;br /&gt;
&lt;br /&gt;
General information that applies to all types of plugins&lt;br /&gt;
*[[Development:Places to search for lang strings|Where to put language strings for your plugin]]&lt;br /&gt;
*[[Development:Installing and upgrading plugin database tables|Defining the database tables for your plugin]]&lt;br /&gt;
&lt;br /&gt;
Please see the [[Development:Guidelines for contributed code|Guidelines for contributed code]] for an overview of how to contribute to the Moodle code.&lt;br /&gt;
&lt;br /&gt;
Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the [[Development:Local_customisation|local customisations]] hook.&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding guidelines|Plugins]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=User:Jeroen_van_den_Eijkhof&amp;diff=77004</id>
		<title>User:Jeroen van den Eijkhof</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=User:Jeroen_van_den_Eijkhof&amp;diff=77004"/>
		<updated>2010-10-23T06:01:29Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am new to Moodle since (2010 Oct) and like to contribute to this Wiki because as a new visitor I see potential that another perspective probably doesn&#039;t :)&lt;br /&gt;
&lt;br /&gt;
Please write on my [[User_talk:Jeroen_van_den_Eijkhof|discussion]] page if you wish to comment on any changes that I have made.&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=User:Jeroen_van_den_Eijkhof&amp;diff=77002</id>
		<title>User:Jeroen van den Eijkhof</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=User:Jeroen_van_den_Eijkhof&amp;diff=77002"/>
		<updated>2010-10-23T05:59:44Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: New page: I am new to Moodle since (2010 Oct) and like to contribute to this Wiki because as a new visitor I see potential that another perspective probably doesn&amp;#039;t :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am new to Moodle since (2010 Oct) and like to contribute to this Wiki because as a new visitor I see potential that another perspective probably doesn&#039;t :)&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=77001</id>
		<title>Development:PHP for novices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=77001"/>
		<updated>2010-10-23T05:58:00Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: Added {{CategoryDeveloper}}&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is written for this who need an introduction into the PHP language. For more documentation please also visit [http://www.php.net/manual PHP.net].&lt;br /&gt;
&lt;br /&gt;
==PHP for complete novices==&lt;br /&gt;
&lt;br /&gt;
Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn. &lt;br /&gt;
&lt;br /&gt;
===How it works===&lt;br /&gt;
When your browser requests a webpage, you are asking for a file. The computer (server) you connect to at the other end of the internet normally sends back a file of [http://en.wikipedia.org/wiki/Html HTML] (which you need to get familiar with if you are not already) that your browser then converts into a webpage. HTML documents are static, meaning that they exist on the server in the same form as they are sent to you. PHP on the other hand is dynamic - the form it exists in on the server is different from what is ultimately sent to you, which may be different for different people. When a PHP file is requested, the server runs the instructions it contains and sends the output (HTML) to you in the normal way. PHP code can either be inserted into part of an HTML document, or can exist in files with nothing but PHP. You can recognise it by its start (&amp;amp;lt;?php) and end (?&amp;amp;gt;) tags&lt;br /&gt;
&lt;br /&gt;
PHP almost always uses a database to store information. That way, the PHP forms a template, that gets filled with whatever information is appropriate to the user e.g. there is a space at the top right of this page for a username, but it is different for everyone. &lt;br /&gt;
&lt;br /&gt;
In the following examples, the numbered line indicates what the intention of the developer is and the text in the box with the blue dashed outline is the code that would actually be written in the php file. Notice that the php lines always end with a ; symbol to indicate the end of a command.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the username box will say some thing like:&lt;br /&gt;
&lt;br /&gt;
1. start a box by printing &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
2. set the font colour to blue by printing &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
3. get the username for user number x from the database&lt;br /&gt;
  $username=fullname(123);&lt;br /&gt;
4. print that username &lt;br /&gt;
  echo $username;&lt;br /&gt;
5. end font colour by printing &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
6. end div by printing &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
  echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
End result (HTML that will be sent to your browser):&lt;br /&gt;
  &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
   &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
     Joe Bloggs&lt;br /&gt;
   &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
In the above example, $username is a variable. It is effectively algebra, where a word of some sort (starting with a dollar sign) represents a piece of data, in this case the username returned by the database.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
In the above example, fullname() is a function. This means a collection of commands (which in this case accesses the user table of the database and returns the name) that have been defined elsewhere, which can be run using a shorthand reference. This saves writing them out hundreds of times in different places. Functions are often written down in large library files, so that they can be used whenever they are needed.&lt;br /&gt;
&lt;br /&gt;
===Including other files===&lt;br /&gt;
&lt;br /&gt;
Moodle is a very complex program. Instead of just one page with a list of commands, it uses a great many files linked together using the [http://uk.php.net/include/ include] or [http://uk.php.net/manual/en/function.require-once.php require_once] commands. This means that when you request e.g. the front page, there will be commands such as the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;config.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means &#039;if its not been done already for this page request, go and get config.php and run all of its instructions before continuing&#039;. In this way, a single Moodle webpage can sometimes include as many as 150 separate files on the server. This is how the library files are made available - you include the library and can then use any of the functions that the library contains e.g. fullname().&lt;br /&gt;
&lt;br /&gt;
===Libraries and functions===&lt;br /&gt;
&lt;br /&gt;
To make the username commands above into a function, we would write them like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function print_username_box($useridnumber) {&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    $username=fullname($useridnumber);&lt;br /&gt;
    echo $username;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever the commands are needed, the developer simply writes&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
print_username_box(123);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{CategoryDeveloper}}&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=76998</id>
		<title>Development:Developer documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=76998"/>
		<updated>2010-10-23T05:50:58Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Core components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:moodle-development-logo.jpg|right|400px]]&lt;br /&gt;
&lt;br /&gt;
This [[:Category:Developer|Developer]] section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.&lt;br /&gt;
&lt;br /&gt;
* If you manage a Moodle site, [[Administrator documentation]] may suit your needs better. &lt;br /&gt;
* If you teach using Moodle, try [[Teacher documentation]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; New developer documentation pages should be added to the &#039;&#039;Development namespace&#039;&#039; by typing &amp;lt;code&amp;gt;Development:&amp;lt;/code&amp;gt; before the new page name i.e. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Development:New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page may be added to the Developer category by adding the template &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{CategoryDeveloper}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to the bottom of the page. - If required, you can use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Developer|Sort key]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to provide a sort key other than the default page name.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How Moodle development works==&lt;br /&gt;
&lt;br /&gt;
The [[Development:Overview|overview of the Moodle development process]] explains how Moodle development occurs and how people become Moodle developers. Current plans are listed on the [[Roadmap]].&lt;br /&gt;
&lt;br /&gt;
You can also enrol in one of the [http://dev.moodle.org Moodle Developer Courses].&lt;br /&gt;
&lt;br /&gt;
==Guidelines==&lt;br /&gt;
&lt;br /&gt;
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:&lt;br /&gt;
*[[Development:Coding|Coding guidelines]] have to be followed by all Moodle developers&lt;br /&gt;
*[[Moodle design goals]] spells out the basic design goals behind Moodle&lt;br /&gt;
*[[CVS (developer)|Moodle CVS for developers]] explains how to work with the Moodle code in CVS&lt;br /&gt;
*[[Tracker]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc&lt;br /&gt;
*[[Development:Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes&lt;br /&gt;
*[[Development:Unit tests|Unit tests]] explains how to run the unit tests, and how to write new test cases.&lt;br /&gt;
*[[Development:Fast portable SQL]] shows SQL techniques that are fast, efficient, and known to work on all supported DBs.&lt;br /&gt;
*[[Development:Development hints and tips]] a (developing) list of general wisdom to help with your Moodle projects.&lt;br /&gt;
&lt;br /&gt;
==Documentation for core components==&lt;br /&gt;
&lt;br /&gt;
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the [[Development:Developer notes|developer notes]] or on the [[Roadmap|roadmap]].&lt;br /&gt;
&lt;br /&gt;
The documents below give a general overview. For detailed function-by-function documentation, see the [http://phpdocs.moodle.org/ phpDocumentor] documentation that is automatically generated from the comments in the code. &lt;br /&gt;
&lt;br /&gt;
And don&#039;t forget that the most up-to-date and detailed description of how the code works is the code itself, and you can [http://xref.moodle.org/nav.html?index.html browse the code online] using [[Development:PHPXref|PHPXref]].&lt;br /&gt;
&lt;br /&gt;
===Getting started===&lt;br /&gt;
&lt;br /&gt;
* (2-3 getting started links here)&lt;br /&gt;
&lt;br /&gt;
===Core components ===&lt;br /&gt;
&lt;br /&gt;
*[[Development:Database schema introduction|The database schema]]&lt;br /&gt;
*[[Development:What happens when you require config.php|What happens when you require config.php]]&lt;br /&gt;
*[[Development:lib/moodlelib.php|lib/moodlelib.php]]&lt;br /&gt;
*[[Development:lib/weblib.php|lib/weblib.php]] for outputting stuff&lt;br /&gt;
*[[Development:JavaScript_functions|JavaScript function available on the client side]]&lt;br /&gt;
*[[Development:XMLDB_Documentation|Database abstraction layer]] @ v[[1.7]]&lt;br /&gt;
*[[Development:Roles|Roles and Capabilities system]] @ v[[1.7]] for controlling who can do what&lt;br /&gt;
*[[Development:lib/formslib.php|Forms library]] @ v[[1.8]] for creating accessible and secure HTML forms that let users edit things&lt;br /&gt;
*[[Development:Using_the_file_API|File API]] @ v[[2.0]] for managing files stored by Moodle&lt;br /&gt;
&lt;br /&gt;
===Core libraries with a more specific uses===&lt;br /&gt;
&lt;br /&gt;
*[[Authentication API]]&lt;br /&gt;
*[[Cookieless Sessions]]&lt;br /&gt;
*[[Email processing]]&lt;br /&gt;
*[[Development:Environment checking|Environment checking]] before install, check the user&#039;s server to ensure Moodle will work there.&lt;br /&gt;
*[[Development:Groups|Groups system]]&lt;br /&gt;
*[[Development:Grades|Gradebook]]&lt;br /&gt;
*[[Development:Moodle Network|Moodle Network]]&lt;br /&gt;
*[[Question engine]]&lt;br /&gt;
*[[Stats package]]&lt;br /&gt;
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]&lt;br /&gt;
*[http://developer.yahoo.com/yui YUI JavaScript library] - YUI was selected as the official AJAX library for Moodle.&lt;br /&gt;
*[[Development:lib/graphlib|lib/graphlib]]&lt;br /&gt;
*[[Development:Admin settings|Admin settings]]&lt;br /&gt;
&lt;br /&gt;
===Modules included in the standard distribution===&lt;br /&gt;
&lt;br /&gt;
*[[Development:Lesson Specification|Lesson Specification]]&lt;br /&gt;
*[[Quiz developer docs|Quiz module]]&lt;br /&gt;
*[[SCORM schema|SCORM module 1.5 schema]]&lt;br /&gt;
&lt;br /&gt;
==How you can contribute==&lt;br /&gt;
&lt;br /&gt;
===Make a new plugin===&lt;br /&gt;
&lt;br /&gt;
The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. There are many types of plugin you can write:&lt;br /&gt;
*[[Development:Modules|Activity modules]], see also [[Development:NEWMODULE Documentation]] (work in progress)&lt;br /&gt;
*[[Development:Admin reports|Admin reports]]&lt;br /&gt;
*[[Development:Assignment types|Assignment types]]&lt;br /&gt;
*[[Development:Authentication plugins|Authentication plugins]]&lt;br /&gt;
*[[Development:Blocks|Blocks]]&lt;br /&gt;
*Content editors (2.0 onwards)&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Development:Course Report Plugins|Course reports]]&lt;br /&gt;
*Course importers (2.0 onwards)&lt;br /&gt;
*[[Development:Database fields|Database fields]]&lt;br /&gt;
*[[Development:Database presets|Database presets]]&lt;br /&gt;
*[[Development:Enrolment plugins|Enrolment plugins]]&lt;br /&gt;
*[[Development:Filters|Filters]]&lt;br /&gt;
*[[Development:Gradebook_Report_Tutorial|Gradebook report]]&lt;br /&gt;
*[[Development:Gradebook export|Gradebook export]]&lt;br /&gt;
*[[Development:Gradebook import|Gradebook import]]&lt;br /&gt;
*Message senders (2.0 onwards)&lt;br /&gt;
*Mnet services&lt;br /&gt;
*Plagiarism detection plugins (2.0 onwards)&lt;br /&gt;
*[[Development:Writing_a_Portfolio_Plugin|Portfolio plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Question_type_plugin_how_to|Question types]]&lt;br /&gt;
*[[Development:Question import/export formats|Question import/export formats]]&lt;br /&gt;
*[[Development:How to write a quiz report plugin|Quiz reports]]&lt;br /&gt;
*[[Development:Repository plugins|Repository plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Resource types|Resource types]]&lt;br /&gt;
*[[Development:Search engine adapters|Search engine adapters]]&lt;br /&gt;
*Themes which are different in [[Development:Themes_2.0|Moodle 2.0]], and [[Theme_basics|earlier versions]].&lt;br /&gt;
*User profile fields&lt;br /&gt;
*Web services (2.0 onwards)&lt;br /&gt;
*Workshop allocators (2.0 onwards)&lt;br /&gt;
*Workshop forms (2.0 onwards)&lt;br /&gt;
*Workshop evaluators (2.0 onwards)&lt;br /&gt;
&lt;br /&gt;
General information that applies to all types of plugins&lt;br /&gt;
*[[Development:Places to search for lang strings|Where to put language strings for your plugin]]&lt;br /&gt;
*[[Development:Installing and upgrading plugin database tables|Defining the database tables for your plugin]]&lt;br /&gt;
&lt;br /&gt;
Please see the [[Development:Guidelines for contributed code|Guidelines for contributed code]] for an overview of how to contribute to the Moodle code.&lt;br /&gt;
&lt;br /&gt;
Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the [[Development:Local_customisation|local customisations]] hook.&lt;br /&gt;
&lt;br /&gt;
===Change core code===&lt;br /&gt;
&lt;br /&gt;
Some types of change can only be made by editing the core Moodle code. Such changes are much harder to maintain than plugins. If you want your core change to be considered for inclusion in the official Moodle release, you need to create an issue in the [[Tracker|tracker]], and attach your change as a [[Development:How_to_create_a_patch|patch]]. It is also a good idea to discuss your ideas in the forums first.  See [[Development:Overview#Major_Development]] for more details.&lt;br /&gt;
&lt;br /&gt;
===Ways to contribute that do not involve PHP programming===&lt;br /&gt;
&lt;br /&gt;
*[[Themes|Create Moodle themes]]&lt;br /&gt;
*[[Translation|Translate Moodle into other languages]]&lt;br /&gt;
*[[MoodleDocs:Guidelines for contributors|Help document Moodle]]&lt;br /&gt;
*[[Development:Tests|Join the testing effort]], which involves [[Tracker|participating in the bug tracker]]&lt;br /&gt;
&lt;br /&gt;
==Plans for the future==&lt;br /&gt;
&lt;br /&gt;
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.&lt;br /&gt;
&lt;br /&gt;
Once ideas begin to crystallize on the forums they can be summarized in this wiki, either as part of the [[Roadmap|roadmap]] or in the form of [[Development:Developer notes|developer notes]]. These pages then form the basis for further discussion in the forums.&lt;br /&gt;
&lt;br /&gt;
*[[Roadmap]]&lt;br /&gt;
*[[Development:Developer notes|Developer notes]]&lt;br /&gt;
*[[Student projects]]&lt;br /&gt;
*[[Developer meetings]]&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
*[[Developer FAQ]] - frequently asked questions, especially useful for newcomers to Moodle&lt;br /&gt;
*[[Development:Finding_your_way_into_the_Moodle_code|Finding your way into the Moodle code]] - also aimed at newcomers&lt;br /&gt;
*[http://tracker.moodle.org/ Moodle tracker] - bug reports, feature requests and other tracked issues&lt;br /&gt;
**[[Firefox tracker search]] - How to setup a firefox quicksearch to easily navigate to moodle bugs&lt;br /&gt;
**[[Firefox tracker search#Firefox Search Plugins|Firefox Search Plugins]] - Find tracked issues even more easily&lt;br /&gt;
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to [[HEAD]]&lt;br /&gt;
*Browse the code online:&lt;br /&gt;
**[http://cvs.moodle.org/moodle/ the code with a complete change history from CVS]&lt;br /&gt;
**[http://xref.moodle.org/index.html the code, with links generated by PHPXref]&lt;br /&gt;
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - compiled nightly from the comment attached to each class and function in the code.  &lt;br /&gt;
*[[Development:Database Schema|Database Schema]] - for recent releases&lt;br /&gt;
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course&lt;br /&gt;
**especially the [http://moodle.org/mod/forum/view.php?id=55 General developer forum]&lt;br /&gt;
**[[Filters used on the Moodle.org forums|cool tricks you can use in the moodle.org forums]]&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
Some tools people use when working on Moodle code:&lt;br /&gt;
&lt;br /&gt;
=== IDEs ===&lt;br /&gt;
&lt;br /&gt;
* [[Development:Setting_up_Netbeans|Setting up NetBeans for Moodle development]] - NetBeans for PHP is a great out-of-the-box editor.&lt;br /&gt;
* [[Development:Setting_up_Eclipse|Setting up Eclipse for Moodle development]] - Eclipse is a great editor to use for php development, if you can work out how to set it up.&lt;br /&gt;
* [[Development:vim|Setting up Vim for Moodle development]]&lt;br /&gt;
* [http://www.aptana.com/ Aptana Studio 2]&lt;br /&gt;
&lt;br /&gt;
=== Browser add-ons ===&lt;br /&gt;
*[http://getfirebug.com Firebug], see [[Development:Firebug]].&lt;br /&gt;
* [[Web developer extension]]&lt;br /&gt;
* [https://addons.mozilla.org/en-US/firefox/addon/394 ViewSourceWith] - The main goal is to view page source with external applications, but you can do a lot of other things as well.&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous === &lt;br /&gt;
*[[Development:ctags|Ctags]] - Using a tags file to navigate code&lt;br /&gt;
*[[W3C_validation|W3C HTML validator]] - Moodle has built in support to make using it easier.&lt;br /&gt;
*[[Development:Windows Installer|Windows Installer]] - Windows Installer documentation for developer.&lt;br /&gt;
&lt;br /&gt;
See also: [http://dev.moodle.org/mod/forum/view.php?id=18 Useful Development Tools forum]in the [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming course]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/security/ Moodle Security Announcements]&lt;br /&gt;
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Developer tools]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:Краткий обзор]]&lt;br /&gt;
[[es:Documentación para Desarrolladores]]&lt;br /&gt;
[[fr:Documentation développeur]]&lt;br /&gt;
[[pt:Desenvolvimento:Documentação para programadores]]&lt;br /&gt;
[[zh:开发者文档]]&lt;br /&gt;
[[ja:開発者ドキュメント]]&lt;br /&gt;
[[fi:Ohjelmoijan opas]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=76997</id>
		<title>Development:PHP for novices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=76997"/>
		<updated>2010-10-23T04:34:23Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is written for this who need an introduction into the PHP language. For more documentation please also visit [http://www.php.net/manual PHP.net].&lt;br /&gt;
&lt;br /&gt;
==PHP for complete novices==&lt;br /&gt;
&lt;br /&gt;
Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn. &lt;br /&gt;
&lt;br /&gt;
===How it works===&lt;br /&gt;
When your browser requests a webpage, you are asking for a file. The computer (server) you connect to at the other end of the internet normally sends back a file of [http://en.wikipedia.org/wiki/Html HTML] (which you need to get familiar with if you are not already) that your browser then converts into a webpage. HTML documents are static, meaning that they exist on the server in the same form as they are sent to you. PHP on the other hand is dynamic - the form it exists in on the server is different from what is ultimately sent to you, which may be different for different people. When a PHP file is requested, the server runs the instructions it contains and sends the output (HTML) to you in the normal way. PHP code can either be inserted into part of an HTML document, or can exist in files with nothing but PHP. You can recognise it by its start (&amp;amp;lt;?php) and end (?&amp;amp;gt;) tags&lt;br /&gt;
&lt;br /&gt;
PHP almost always uses a database to store information. That way, the PHP forms a template, that gets filled with whatever information is appropriate to the user e.g. there is a space at the top right of this page for a username, but it is different for everyone. &lt;br /&gt;
&lt;br /&gt;
In the following examples, the numbered line indicates what the intention of the developer is and the text in the box with the blue dashed outline is the code that would actually be written in the php file. Notice that the php lines always end with a ; symbol to indicate the end of a command.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the username box will say some thing like:&lt;br /&gt;
&lt;br /&gt;
1. start a box by printing &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
2. set the font colour to blue by printing &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
3. get the username for user number x from the database&lt;br /&gt;
  $username=fullname(123);&lt;br /&gt;
4. print that username &lt;br /&gt;
  echo $username;&lt;br /&gt;
5. end font colour by printing &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
6. end div by printing &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
  echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
End result (HTML that will be sent to your browser):&lt;br /&gt;
  &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
   &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
     Joe Bloggs&lt;br /&gt;
   &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
In the above example, $username is a variable. It is effectively algebra, where a word of some sort (starting with a dollar sign) represents a piece of data, in this case the username returned by the database.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
In the above example, fullname() is a function. This means a collection of commands (which in this case accesses the user table of the database and returns the name) that have been defined elsewhere, which can be run using a shorthand reference. This saves writing them out hundreds of times in different places. Functions are often written down in large library files, so that they can be used whenever they are needed.&lt;br /&gt;
&lt;br /&gt;
===Including other files===&lt;br /&gt;
&lt;br /&gt;
Moodle is a very complex program. Instead of just one page with a list of commands, it uses a great many files linked together using the [http://uk.php.net/include/ include] or [http://uk.php.net/manual/en/function.require-once.php require_once] commands. This means that when you request e.g. the front page, there will be commands such as the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;config.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means &#039;if its not been done already for this page request, go and get config.php and run all of its instructions before continuing&#039;. In this way, a single Moodle webpage can sometimes include as many as 150 separate files on the server. This is how the library files are made available - you include the library and can then use any of the functions that the library contains e.g. fullname().&lt;br /&gt;
&lt;br /&gt;
===Libraries and functions===&lt;br /&gt;
&lt;br /&gt;
To make the username commands above into a function, we would write them like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function print_username_box($useridnumber) {&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    $username=fullname($useridnumber);&lt;br /&gt;
    echo $username;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever the commands are needed, the developer simply writes&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
print_username_box(123);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=76996</id>
		<title>Development:PHP for novices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:PHP_for_novices&amp;diff=76996"/>
		<updated>2010-10-23T04:32:37Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: New page: ==PHP for complete novices==  Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn.   ===How it works=== When your browser requests a webpage, you are asking...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==PHP for complete novices==&lt;br /&gt;
&lt;br /&gt;
Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn. &lt;br /&gt;
&lt;br /&gt;
===How it works===&lt;br /&gt;
When your browser requests a webpage, you are asking for a file. The computer (server) you connect to at the other end of the internet normally sends back a file of [http://en.wikipedia.org/wiki/Html HTML] (which you need to get familiar with if you are not already) that your browser then converts into a webpage. HTML documents are static, meaning that they exist on the server in the same form as they are sent to you. PHP on the other hand is dynamic - the form it exists in on the server is different from what is ultimately sent to you, which may be different for different people. When a PHP file is requested, the server runs the instructions it contains and sends the output (HTML) to you in the normal way. PHP code can either be inserted into part of an HTML document, or can exist in files with nothing but PHP. You can recognise it by its start (&amp;amp;lt;?php) and end (?&amp;amp;gt;) tags&lt;br /&gt;
&lt;br /&gt;
PHP almost always uses a database to store information. That way, the PHP forms a template, that gets filled with whatever information is appropriate to the user e.g. there is a space at the top right of this page for a username, but it is different for everyone. &lt;br /&gt;
&lt;br /&gt;
In the following examples, the numbered line indicates what the intention of the developer is and the text in the box with the blue dashed outline is the code that would actually be written in the php file. Notice that the php lines always end with a ; symbol to indicate the end of a command.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the username box will say some thing like:&lt;br /&gt;
&lt;br /&gt;
1. start a box by printing &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
2. set the font colour to blue by printing &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
3. get the username for user number x from the database&lt;br /&gt;
  $username=fullname(123);&lt;br /&gt;
4. print that username &lt;br /&gt;
  echo $username;&lt;br /&gt;
5. end font colour by printing &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
6. end div by printing &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
  echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
End result (HTML that will be sent to your browser):&lt;br /&gt;
  &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
   &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
     Joe Bloggs&lt;br /&gt;
   &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
In the above example, $username is a variable. It is effectively algebra, where a word of some sort (starting with a dollar sign) represents a piece of data, in this case the username returned by the database.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
In the above example, fullname() is a function. This means a collection of commands (which in this case accesses the user table of the database and returns the name) that have been defined elsewhere, which can be run using a shorthand reference. This saves writing them out hundreds of times in different places. Functions are often written down in large library files, so that they can be used whenever they are needed.&lt;br /&gt;
&lt;br /&gt;
===Including other files===&lt;br /&gt;
&lt;br /&gt;
Moodle is a very complex program. Instead of just one page with a list of commands, it uses a great many files linked together using the [http://uk.php.net/include/ include] or [http://uk.php.net/manual/en/function.require-once.php require_once] commands. This means that when you request e.g. the front page, there will be commands such as the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;config.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means &#039;if its not been done already for this page request, go and get config.php and run all of its instructions before continuing&#039;. In this way, a single Moodle webpage can sometimes include as many as 150 separate files on the server. This is how the library files are made available - you include the library and can then use any of the functions that the library contains e.g. fullname().&lt;br /&gt;
&lt;br /&gt;
===Libraries and functions===&lt;br /&gt;
&lt;br /&gt;
To make the username commands above into a function, we would write them like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function print_username_box($useridnumber) {&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    $username=fullname($useridnumber);&lt;br /&gt;
    echo $username;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever the commands are needed, the developer simply writes&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
print_username_box(123);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76995</id>
		<title>Development:Finding your way into the Moodle code</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76995"/>
		<updated>2010-10-23T04:32:23Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: Moved PHP into new page where it can thrive on it&amp;#039;s own :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is aimed at people totally new to Moodle development and have some PHP experience, if you don&#039;t have that experience please visit [[Development:PHP for novices|PHP for novices]]. It is a few tips to help you get started with the mass of Moodle code.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add more tips here, but I think it is also good if we can keep this article quite short.&lt;br /&gt;
&lt;br /&gt;
==Developer documentation==&lt;br /&gt;
&lt;br /&gt;
If you have not already found it, the main source of developer documentation is [[Development:Developer_documentation]].&lt;br /&gt;
&lt;br /&gt;
==Finding a way in==&lt;br /&gt;
&lt;br /&gt;
For finding where to start, you need to know that when you are looking at, for example, http://moodle.org/mod/forum/discuss.php?d=82799, then the code for that is in /mod/forum/discuss.php, and you just need to follow through what it does.&lt;br /&gt;
&lt;br /&gt;
It calls functions in the main Moodle libraries, and the three most important are:&lt;br /&gt;
&lt;br /&gt;
*lib/moodlelib.php - general stuff.&lt;br /&gt;
*lib/weblib.php - things to do with output of HTML&lt;br /&gt;
*lib/dmllib.php - things to do with getting data in and out of the database.&lt;br /&gt;
&lt;br /&gt;
==Understanding what you find==&lt;br /&gt;
&lt;br /&gt;
As you look at the code, it is often a good idea, to insert statements like &lt;br /&gt;
 debugging(&#039;In function require_login&#039;);&lt;br /&gt;
which will print the message above if it gets far enough so you know the code has not stalled before there, or&lt;br /&gt;
 print_object($course);&lt;br /&gt;
which will print out a variable, showing you what it contains. &lt;br /&gt;
&lt;br /&gt;
Variable like $course are often objects with lots of fields. Seeing what they contain will help you understand what is going on. The first of these prints out whatever text you give it, and information about the sequence of function calls that the code took to get there. (It only works if you go to &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Debugging]]&#039;&#039;, and turn the debug level to ALL or DEVELOPER.)&lt;br /&gt;
&lt;br /&gt;
==Tools that can help==&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Eclipse&#039;&#039;&#039;, for instance helps finding function definitions. You can hold down CTRL and click on the name of a function, it immediately jumps you to where that function is defined. ([[Development:Setting_up_Eclipse]])&lt;br /&gt;
*&#039;&#039;&#039;Emacs&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;Vim&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;TextMate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
See also [[Development:Developer documentation#Tools]] and [[:Category:Developer tools]].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* First posted at http://moodle.org/mod/forum/discuss.php?d=82799#p366264&lt;br /&gt;
* [[Development:Developer_documentation]]&lt;br /&gt;
* [[Development:Overview]]&lt;br /&gt;
* [[Development:ctags]]&lt;br /&gt;
* [http://blog.danpoltawski.co.uk/archives/2009-05-Secrets-of-Learning-Moodle-Development!.html &amp;quot;Secrets of Learning Moodle Development!&amp;quot;] by Moodle core developer [[User:Dan Poltawski| Dan Poltawski]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76994</id>
		<title>Development:Finding your way into the Moodle code</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76994"/>
		<updated>2010-10-23T04:29:04Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Tools can help */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is aimed at people totally new to Moodle development, who may, or may not, have previous programming experience. It is a few tips to help you get started with the mass of Moodle code.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add more tips here, but I think it is also good if we can keep this article quite short.&lt;br /&gt;
&lt;br /&gt;
==Developer documentation==&lt;br /&gt;
&lt;br /&gt;
If you have not already found it, the main source of developer documentation is [[Development:Developer_documentation]].&lt;br /&gt;
&lt;br /&gt;
==Finding a way in==&lt;br /&gt;
&lt;br /&gt;
For finding where to start, you need to know that when you are looking at, for example, http://moodle.org/mod/forum/discuss.php?d=82799, then the code for that is in /mod/forum/discuss.php, and you just need to follow through what it does.&lt;br /&gt;
&lt;br /&gt;
It calls functions in the main Moodle libraries, and the three most important are:&lt;br /&gt;
&lt;br /&gt;
*lib/moodlelib.php - general stuff.&lt;br /&gt;
*lib/weblib.php - things to do with output of HTML&lt;br /&gt;
*lib/dmllib.php - things to do with getting data in and out of the database.&lt;br /&gt;
&lt;br /&gt;
==Understanding what you find==&lt;br /&gt;
&lt;br /&gt;
As you look at the code, it is often a good idea, to insert statements like &lt;br /&gt;
 debugging(&#039;In function require_login&#039;);&lt;br /&gt;
which will print the message above if it gets far enough so you know the code has not stalled before there, or&lt;br /&gt;
 print_object($course);&lt;br /&gt;
which will print out a variable, showing you what it contains. &lt;br /&gt;
&lt;br /&gt;
Variable like $course are often objects with lots of fields. Seeing what they contain will help you understand what is going on. The first of these prints out whatever text you give it, and information about the sequence of function calls that the code took to get there. (It only works if you go to &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Debugging]]&#039;&#039;, and turn the debug level to ALL or DEVELOPER.)&lt;br /&gt;
&lt;br /&gt;
==Tools that can help==&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Eclipse&#039;&#039;&#039;, for instance helps finding function definitions. You can hold down CTRL and click on the name of a function, it immediately jumps you to where that function is defined. ([[Development:Setting_up_Eclipse]])&lt;br /&gt;
*&#039;&#039;&#039;Emacs&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;Vim&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;TextMate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
See also [[Development:Developer documentation#Tools]] and [[:Category:Developer tools]].&lt;br /&gt;
&lt;br /&gt;
==PHP for complete novices==&lt;br /&gt;
&lt;br /&gt;
Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn. &lt;br /&gt;
&lt;br /&gt;
===How it works===&lt;br /&gt;
When your browser requests a webpage, you are asking for a file. The computer (server) you connect to at the other end of the internet normally sends back a file of [http://en.wikipedia.org/wiki/Html HTML] (which you need to get familiar with if you are not already) that your browser then converts into a webpage. HTML documents are static, meaning that they exist on the server in the same form as they are sent to you. PHP on the other hand is dynamic - the form it exists in on the server is different from what is ultimately sent to you, which may be different for different people. When a PHP file is requested, the server runs the instructions it contains and sends the output (HTML) to you in the normal way. PHP code can either be inserted into part of an HTML document, or can exist in files with nothing but PHP. You can recognise it by its start (&amp;amp;lt;?php) and end (?&amp;amp;gt;) tags&lt;br /&gt;
&lt;br /&gt;
PHP almost always uses a database to store information. That way, the PHP forms a template, that gets filled with whatever information is appropriate to the user e.g. there is a space at the top right of this page for a username, but it is different for everyone. &lt;br /&gt;
&lt;br /&gt;
In the following examples, the numbered line indicates what the intention of the developer is and the text in the box with the blue dashed outline is the code that would actually be written in the php file. Notice that the php lines always end with a ; symbol to indicate the end of a command.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the username box will say some thing like:&lt;br /&gt;
&lt;br /&gt;
1. start a box by printing &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
2. set the font colour to blue by printing &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
3. get the username for user number x from the database&lt;br /&gt;
  $username=fullname(123);&lt;br /&gt;
4. print that username &lt;br /&gt;
  echo $username;&lt;br /&gt;
5. end font colour by printing &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
6. end div by printing &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
  echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
End result (HTML that will be sent to your browser):&lt;br /&gt;
  &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
   &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
     Joe Bloggs&lt;br /&gt;
   &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
In the above example, $username is a variable. It is effectively algebra, where a word of some sort (starting with a dollar sign) represents a piece of data, in this case the username returned by the database.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
In the above example, fullname() is a function. This means a collection of commands (which in this case accesses the user table of the database and returns the name) that have been defined elsewhere, which can be run using a shorthand reference. This saves writing them out hundreds of times in different places. Functions are often written down in large library files, so that they can be used whenever they are needed.&lt;br /&gt;
&lt;br /&gt;
===Including other files===&lt;br /&gt;
&lt;br /&gt;
Moodle is a very complex program. Instead of just one page with a list of commands, it uses a great many files linked together using the [http://uk.php.net/include/ include] or [http://uk.php.net/manual/en/function.require-once.php require_once] commands. This means that when you request e.g. the front page, there will be commands such as the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;config.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means &#039;if its not been done already for this page request, go and get config.php and run all of its instructions before continuing&#039;. In this way, a single Moodle webpage can sometimes include as many as 150 separate files on the server. This is how the library files are made available - you include the library and can then use any of the functions that the library contains e.g. fullname().&lt;br /&gt;
&lt;br /&gt;
===Libraries and functions===&lt;br /&gt;
&lt;br /&gt;
To make the username commands above into a function, we would write them like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function print_username_box($useridnumber) {&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    $username=fullname($useridnumber);&lt;br /&gt;
    echo $username;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever the commands are needed, the developer simply writes&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
print_username_box(123);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* First posted at http://moodle.org/mod/forum/discuss.php?d=82799#p366264&lt;br /&gt;
* [[Development:Developer_documentation]]&lt;br /&gt;
* [[Development:Overview]]&lt;br /&gt;
* [[Development:ctags]]&lt;br /&gt;
* [http://blog.danpoltawski.co.uk/archives/2009-05-Secrets-of-Learning-Moodle-Development!.html &amp;quot;Secrets of Learning Moodle Development!&amp;quot;] by Moodle core developer [[User:Dan Poltawski| Dan Poltawski]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76993</id>
		<title>Development:Finding your way into the Moodle code</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Finding_your_way_into_the_Moodle_code&amp;diff=76993"/>
		<updated>2010-10-23T04:20:57Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: Changed the order since the page *is* called Finding your way in...and most people don&amp;#039;t need a PHP quickstart...maybe on a new page?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is aimed at people totally new to Moodle development, who may, or may not, have previous programming experience. It is a few tips to help you get started with the mass of Moodle code.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add more tips here, but I think it is also good if we can keep this article quite short.&lt;br /&gt;
&lt;br /&gt;
==Developer documentation==&lt;br /&gt;
&lt;br /&gt;
If you have not already found it, the main source of developer documentation is [[Development:Developer_documentation]].&lt;br /&gt;
&lt;br /&gt;
==Finding a way in==&lt;br /&gt;
&lt;br /&gt;
For finding where to start, you need to know that when you are looking at, for example, http://moodle.org/mod/forum/discuss.php?d=82799, then the code for that is in /mod/forum/discuss.php, and you just need to follow through what it does.&lt;br /&gt;
&lt;br /&gt;
It calls functions in the main Moodle libraries, and the three most important are:&lt;br /&gt;
&lt;br /&gt;
*lib/moodlelib.php - general stuff.&lt;br /&gt;
*lib/weblib.php - things to do with output of HTML&lt;br /&gt;
*lib/dmllib.php - things to do with getting data in and out of the database.&lt;br /&gt;
&lt;br /&gt;
==Understanding what you find==&lt;br /&gt;
&lt;br /&gt;
As you look at the code, it is often a good idea, to insert statements like &lt;br /&gt;
 debugging(&#039;In function require_login&#039;);&lt;br /&gt;
which will print the message above if it gets far enough so you know the code has not stalled before there, or&lt;br /&gt;
 print_object($course);&lt;br /&gt;
which will print out a variable, showing you what it contains. &lt;br /&gt;
&lt;br /&gt;
Variable like $course are often objects with lots of fields. Seeing what they contain will help you understand what is going on. The first of these prints out whatever text you give it, and information about the sequence of function calls that the code took to get there. (It only works if you go to &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Debugging]]&#039;&#039;, and turn the debug level to ALL or DEVELOPER.)&lt;br /&gt;
&lt;br /&gt;
==Tools can help==&lt;br /&gt;
&lt;br /&gt;
Finally, it is helpful to have an editor that lets you jump around the code. &lt;br /&gt;
&lt;br /&gt;
For example, I like &#039;&#039;&#039;Eclipse&#039;&#039;&#039;, and if I hold down CTRL and click on the name of a function, it immediately jumps me to where that function is defined. Most good editors (including Emacs and vi/Vim) can do this (see [[Development:Setting_up_Eclipse]]).&lt;br /&gt;
&lt;br /&gt;
See also [[Development:Developer documentation#Tools]] and [[:Category:Developer tools]].&lt;br /&gt;
&lt;br /&gt;
==PHP for complete novices==&lt;br /&gt;
&lt;br /&gt;
Moodle is written in [http://www.php.net PHP] - a relatively easy language to learn. &lt;br /&gt;
&lt;br /&gt;
===How it works===&lt;br /&gt;
When your browser requests a webpage, you are asking for a file. The computer (server) you connect to at the other end of the internet normally sends back a file of [http://en.wikipedia.org/wiki/Html HTML] (which you need to get familiar with if you are not already) that your browser then converts into a webpage. HTML documents are static, meaning that they exist on the server in the same form as they are sent to you. PHP on the other hand is dynamic - the form it exists in on the server is different from what is ultimately sent to you, which may be different for different people. When a PHP file is requested, the server runs the instructions it contains and sends the output (HTML) to you in the normal way. PHP code can either be inserted into part of an HTML document, or can exist in files with nothing but PHP. You can recognise it by its start (&amp;amp;lt;?php) and end (?&amp;amp;gt;) tags&lt;br /&gt;
&lt;br /&gt;
PHP almost always uses a database to store information. That way, the PHP forms a template, that gets filled with whatever information is appropriate to the user e.g. there is a space at the top right of this page for a username, but it is different for everyone. &lt;br /&gt;
&lt;br /&gt;
In the following examples, the numbered line indicates what the intention of the developer is and the text in the box with the blue dashed outline is the code that would actually be written in the php file. Notice that the php lines always end with a ; symbol to indicate the end of a command.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the username box will say some thing like:&lt;br /&gt;
&lt;br /&gt;
1. start a box by printing &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
2. set the font colour to blue by printing &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
3. get the username for user number x from the database&lt;br /&gt;
  $username=fullname(123);&lt;br /&gt;
4. print that username &lt;br /&gt;
  echo $username;&lt;br /&gt;
5. end font colour by printing &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
6. end div by printing &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
  echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
End result (HTML that will be sent to your browser):&lt;br /&gt;
  &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
   &amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&lt;br /&gt;
     Joe Bloggs&lt;br /&gt;
   &amp;amp;lt;/font&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
In the above example, $username is a variable. It is effectively algebra, where a word of some sort (starting with a dollar sign) represents a piece of data, in this case the username returned by the database.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
In the above example, fullname() is a function. This means a collection of commands (which in this case accesses the user table of the database and returns the name) that have been defined elsewhere, which can be run using a shorthand reference. This saves writing them out hundreds of times in different places. Functions are often written down in large library files, so that they can be used whenever they are needed.&lt;br /&gt;
&lt;br /&gt;
===Including other files===&lt;br /&gt;
&lt;br /&gt;
Moodle is a very complex program. Instead of just one page with a list of commands, it uses a great many files linked together using the [http://uk.php.net/include/ include] or [http://uk.php.net/manual/en/function.require-once.php require_once] commands. This means that when you request e.g. the front page, there will be commands such as the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;config.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means &#039;if its not been done already for this page request, go and get config.php and run all of its instructions before continuing&#039;. In this way, a single Moodle webpage can sometimes include as many as 150 separate files on the server. This is how the library files are made available - you include the library and can then use any of the functions that the library contains e.g. fullname().&lt;br /&gt;
&lt;br /&gt;
===Libraries and functions===&lt;br /&gt;
&lt;br /&gt;
To make the username commands above into a function, we would write them like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function print_username_box($useridnumber) {&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;div&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;font color=&amp;quot;#002bb8&amp;quot;&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    $username=fullname($useridnumber);&lt;br /&gt;
    echo $username;&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/font&amp;amp;gt;&amp;quot;;&lt;br /&gt;
    echo &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever the commands are needed, the developer simply writes&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
print_username_box(123);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* First posted at http://moodle.org/mod/forum/discuss.php?d=82799#p366264&lt;br /&gt;
* [[Development:Developer_documentation]]&lt;br /&gt;
* [[Development:Overview]]&lt;br /&gt;
* [[Development:ctags]]&lt;br /&gt;
* [http://blog.danpoltawski.co.uk/archives/2009-05-Secrets-of-Learning-Moodle-Development!.html &amp;quot;Secrets of Learning Moodle Development!&amp;quot;] by Moodle core developer [[User:Dan Poltawski| Dan Poltawski]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=76992</id>
		<title>Development:Developer documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Developer_documentation&amp;diff=76992"/>
		<updated>2010-10-23T04:19:06Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Documentation for core components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:moodle-development-logo.jpg|right|400px]]&lt;br /&gt;
&lt;br /&gt;
This [[:Category:Developer|Developer]] section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.&lt;br /&gt;
&lt;br /&gt;
* If you manage a Moodle site, [[Administrator documentation]] may suit your needs better. &lt;br /&gt;
* If you teach using Moodle, try [[Teacher documentation]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; New developer documentation pages should be added to the &#039;&#039;Development namespace&#039;&#039; by typing &amp;lt;code&amp;gt;Development:&amp;lt;/code&amp;gt; before the new page name i.e. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Development:New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page may be added to the Developer category by adding the template &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{CategoryDeveloper}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to the bottom of the page. - If required, you can use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Developer|Sort key]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to provide a sort key other than the default page name.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How Moodle development works==&lt;br /&gt;
&lt;br /&gt;
The [[Development:Overview|overview of the Moodle development process]] explains how Moodle development occurs and how people become Moodle developers. Current plans are listed on the [[Roadmap]].&lt;br /&gt;
&lt;br /&gt;
You can also enrol in one of the [http://dev.moodle.org Moodle Developer Courses].&lt;br /&gt;
&lt;br /&gt;
==Guidelines==&lt;br /&gt;
&lt;br /&gt;
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:&lt;br /&gt;
*[[Development:Coding|Coding guidelines]] have to be followed by all Moodle developers&lt;br /&gt;
*[[Moodle design goals]] spells out the basic design goals behind Moodle&lt;br /&gt;
*[[CVS (developer)|Moodle CVS for developers]] explains how to work with the Moodle code in CVS&lt;br /&gt;
*[[Tracker]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc&lt;br /&gt;
*[[Development:Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes&lt;br /&gt;
*[[Development:Unit tests|Unit tests]] explains how to run the unit tests, and how to write new test cases.&lt;br /&gt;
*[[Development:Fast portable SQL]] shows SQL techniques that are fast, efficient, and known to work on all supported DBs.&lt;br /&gt;
*[[Development:Development hints and tips]] a (developing) list of general wisdom to help with your Moodle projects.&lt;br /&gt;
&lt;br /&gt;
==Documentation for core components==&lt;br /&gt;
&lt;br /&gt;
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the [[Development:Developer notes|developer notes]] or on the [[Roadmap|roadmap]].&lt;br /&gt;
&lt;br /&gt;
The documents below give a general overview. For detailed function-by-function documentation, see the [http://phpdocs.moodle.org/ phpDocumentor] documentation that is automatically generated from the comments in the code. &lt;br /&gt;
&lt;br /&gt;
And don&#039;t forget that the most up-to-date and detailed description of how the code works is the code itself, and you can [http://xref.moodle.org/nav.html?index.html browse the code online] using [[Development:PHPXref|PHPXref]].&lt;br /&gt;
&lt;br /&gt;
===Getting started===&lt;br /&gt;
&lt;br /&gt;
* (2-3 getting started links here)&lt;br /&gt;
&lt;br /&gt;
===Core components ===&lt;br /&gt;
&lt;br /&gt;
*[[Development:Database schema introduction|The database schema]]&lt;br /&gt;
*[[Development:What happens when you require config.php|What happens when you require config.php]]&lt;br /&gt;
*lib/moodlelib.php &lt;br /&gt;
*[[Development:lib/weblib.php|lib/weblib.php]] for outputting stuff&lt;br /&gt;
*[[Development:JavaScript_functions|JavaScript function available on the client side]]&lt;br /&gt;
*[[Development:XMLDB_Documentation|Database abstraction layer]] @ v[[1.7]]&lt;br /&gt;
*[[Development:Roles|Roles and Capabilities system]] @ v[[1.7]] for controlling who can do what&lt;br /&gt;
*[[Development:lib/formslib.php|Forms library]] @ v[[1.8]] for creating accessible and secure HTML forms that let users edit things&lt;br /&gt;
*[[Development:Using_the_file_API|File API]] @ v[[2.0]] for managing files stored by Moodle&lt;br /&gt;
&lt;br /&gt;
===Core libraries with a more specific uses===&lt;br /&gt;
&lt;br /&gt;
*[[Authentication API]]&lt;br /&gt;
*[[Cookieless Sessions]]&lt;br /&gt;
*[[Email processing]]&lt;br /&gt;
*[[Development:Environment checking|Environment checking]] before install, check the user&#039;s server to ensure Moodle will work there.&lt;br /&gt;
*[[Development:Groups|Groups system]]&lt;br /&gt;
*[[Development:Grades|Gradebook]]&lt;br /&gt;
*[[Development:Moodle Network|Moodle Network]]&lt;br /&gt;
*[[Question engine]]&lt;br /&gt;
*[[Stats package]]&lt;br /&gt;
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]&lt;br /&gt;
*[http://developer.yahoo.com/yui YUI JavaScript library] - YUI was selected as the official AJAX library for Moodle.&lt;br /&gt;
*[[Development:lib/graphlib|lib/graphlib]]&lt;br /&gt;
*[[Development:Admin settings|Admin settings]]&lt;br /&gt;
&lt;br /&gt;
===Modules included in the standard distribution===&lt;br /&gt;
&lt;br /&gt;
*[[Development:Lesson Specification|Lesson Specification]]&lt;br /&gt;
*[[Quiz developer docs|Quiz module]]&lt;br /&gt;
*[[SCORM schema|SCORM module 1.5 schema]]&lt;br /&gt;
&lt;br /&gt;
==How you can contribute==&lt;br /&gt;
&lt;br /&gt;
===Make a new plugin===&lt;br /&gt;
&lt;br /&gt;
The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. There are many types of plugin you can write:&lt;br /&gt;
*[[Development:Modules|Activity modules]], see also [[Development:NEWMODULE Documentation]] (work in progress)&lt;br /&gt;
*[[Development:Admin reports|Admin reports]]&lt;br /&gt;
*[[Development:Assignment types|Assignment types]]&lt;br /&gt;
*[[Development:Authentication plugins|Authentication plugins]]&lt;br /&gt;
*[[Development:Blocks|Blocks]]&lt;br /&gt;
*Content editors (2.0 onwards)&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Development:Course Report Plugins|Course reports]]&lt;br /&gt;
*Course importers (2.0 onwards)&lt;br /&gt;
*[[Development:Database fields|Database fields]]&lt;br /&gt;
*[[Development:Database presets|Database presets]]&lt;br /&gt;
*[[Development:Enrolment plugins|Enrolment plugins]]&lt;br /&gt;
*[[Development:Filters|Filters]]&lt;br /&gt;
*[[Development:Gradebook_Report_Tutorial|Gradebook report]]&lt;br /&gt;
*[[Development:Gradebook export|Gradebook export]]&lt;br /&gt;
*[[Development:Gradebook import|Gradebook import]]&lt;br /&gt;
*Message senders (2.0 onwards)&lt;br /&gt;
*Mnet services&lt;br /&gt;
*Plagiarism detection plugins (2.0 onwards)&lt;br /&gt;
*[[Development:Writing_a_Portfolio_Plugin|Portfolio plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Question_type_plugin_how_to|Question types]]&lt;br /&gt;
*[[Development:Question import/export formats|Question import/export formats]]&lt;br /&gt;
*[[Development:How to write a quiz report plugin|Quiz reports]]&lt;br /&gt;
*[[Development:Repository plugins|Repository plugins]] (2.0 onwards)&lt;br /&gt;
*[[Development:Resource types|Resource types]]&lt;br /&gt;
*[[Development:Search engine adapters|Search engine adapters]]&lt;br /&gt;
*Themes which are different in [[Development:Themes_2.0|Moodle 2.0]], and [[Theme_basics|earlier versions]].&lt;br /&gt;
*User profile fields&lt;br /&gt;
*Web services (2.0 onwards)&lt;br /&gt;
*Workshop allocators (2.0 onwards)&lt;br /&gt;
*Workshop forms (2.0 onwards)&lt;br /&gt;
*Workshop evaluators (2.0 onwards)&lt;br /&gt;
&lt;br /&gt;
General information that applies to all types of plugins&lt;br /&gt;
*[[Development:Places to search for lang strings|Where to put language strings for your plugin]]&lt;br /&gt;
*[[Development:Installing and upgrading plugin database tables|Defining the database tables for your plugin]]&lt;br /&gt;
&lt;br /&gt;
Please see the [[Development:Guidelines for contributed code|Guidelines for contributed code]] for an overview of how to contribute to the Moodle code.&lt;br /&gt;
&lt;br /&gt;
Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the [[Development:Local_customisation|local customisations]] hook.&lt;br /&gt;
&lt;br /&gt;
===Change core code===&lt;br /&gt;
&lt;br /&gt;
Some types of change can only be made by editing the core Moodle code. Such changes are much harder to maintain than plugins. If you want your core change to be considered for inclusion in the official Moodle release, you need to create an issue in the [[Tracker|tracker]], and attach your change as a [[Development:How_to_create_a_patch|patch]]. It is also a good idea to discuss your ideas in the forums first.  See [[Development:Overview#Major_Development]] for more details.&lt;br /&gt;
&lt;br /&gt;
===Ways to contribute that do not involve PHP programming===&lt;br /&gt;
&lt;br /&gt;
*[[Themes|Create Moodle themes]]&lt;br /&gt;
*[[Translation|Translate Moodle into other languages]]&lt;br /&gt;
*[[MoodleDocs:Guidelines for contributors|Help document Moodle]]&lt;br /&gt;
*[[Development:Tests|Join the testing effort]], which involves [[Tracker|participating in the bug tracker]]&lt;br /&gt;
&lt;br /&gt;
==Plans for the future==&lt;br /&gt;
&lt;br /&gt;
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.&lt;br /&gt;
&lt;br /&gt;
Once ideas begin to crystallize on the forums they can be summarized in this wiki, either as part of the [[Roadmap|roadmap]] or in the form of [[Development:Developer notes|developer notes]]. These pages then form the basis for further discussion in the forums.&lt;br /&gt;
&lt;br /&gt;
*[[Roadmap]]&lt;br /&gt;
*[[Development:Developer notes|Developer notes]]&lt;br /&gt;
*[[Student projects]]&lt;br /&gt;
*[[Developer meetings]]&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
*[[Developer FAQ]] - frequently asked questions, especially useful for newcomers to Moodle&lt;br /&gt;
*[[Development:Finding_your_way_into_the_Moodle_code|Finding your way into the Moodle code]] - also aimed at newcomers&lt;br /&gt;
*[http://tracker.moodle.org/ Moodle tracker] - bug reports, feature requests and other tracked issues&lt;br /&gt;
**[[Firefox tracker search]] - How to setup a firefox quicksearch to easily navigate to moodle bugs&lt;br /&gt;
**[[Firefox tracker search#Firefox Search Plugins|Firefox Search Plugins]] - Find tracked issues even more easily&lt;br /&gt;
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to [[HEAD]]&lt;br /&gt;
*Browse the code online:&lt;br /&gt;
**[http://cvs.moodle.org/moodle/ the code with a complete change history from CVS]&lt;br /&gt;
**[http://xref.moodle.org/index.html the code, with links generated by PHPXref]&lt;br /&gt;
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - compiled nightly from the comment attached to each class and function in the code.  &lt;br /&gt;
*[[Development:Database Schema|Database Schema]] - for recent releases&lt;br /&gt;
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course&lt;br /&gt;
**especially the [http://moodle.org/mod/forum/view.php?id=55 General developer forum]&lt;br /&gt;
**[[Filters used on the Moodle.org forums|cool tricks you can use in the moodle.org forums]]&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
Some tools people use when working on Moodle code:&lt;br /&gt;
&lt;br /&gt;
=== IDEs ===&lt;br /&gt;
&lt;br /&gt;
* [[Development:Setting_up_Netbeans|Setting up NetBeans for Moodle development]] - NetBeans for PHP is a great out-of-the-box editor.&lt;br /&gt;
* [[Development:Setting_up_Eclipse|Setting up Eclipse for Moodle development]] - Eclipse is a great editor to use for php development, if you can work out how to set it up.&lt;br /&gt;
* [[Development:vim|Setting up Vim for Moodle development]]&lt;br /&gt;
* [http://www.aptana.com/ Aptana Studio 2]&lt;br /&gt;
&lt;br /&gt;
=== Browser add-ons ===&lt;br /&gt;
*[http://getfirebug.com Firebug], see [[Development:Firebug]].&lt;br /&gt;
* [[Web developer extension]]&lt;br /&gt;
* [https://addons.mozilla.org/en-US/firefox/addon/394 ViewSourceWith] - The main goal is to view page source with external applications, but you can do a lot of other things as well.&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous === &lt;br /&gt;
*[[Development:ctags|Ctags]] - Using a tags file to navigate code&lt;br /&gt;
*[[W3C_validation|W3C HTML validator]] - Moodle has built in support to make using it easier.&lt;br /&gt;
*[[Development:Windows Installer|Windows Installer]] - Windows Installer documentation for developer.&lt;br /&gt;
&lt;br /&gt;
See also: [http://dev.moodle.org/mod/forum/view.php?id=18 Useful Development Tools forum]in the [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming course]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/security/ Moodle Security Announcements]&lt;br /&gt;
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Developer tools]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Development:Краткий обзор]]&lt;br /&gt;
[[es:Documentación para Desarrolladores]]&lt;br /&gt;
[[fr:Documentation développeur]]&lt;br /&gt;
[[pt:Desenvolvimento:Documentação para programadores]]&lt;br /&gt;
[[zh:开发者文档]]&lt;br /&gt;
[[ja:開発者ドキュメント]]&lt;br /&gt;
[[fi:Ohjelmoijan opas]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=76991</id>
		<title>Mentees block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=76991"/>
		<updated>2010-10-23T04:16:13Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 1.8}}&lt;br /&gt;
A &#039;&#039;&#039;Mentees block&#039;&#039;&#039; is a frontpage block that provides mentors with quick access to their mentee(s) profile page(s).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Mentees block&#039;&#039;&#039;, works from Moodle 1.8 onwards and may be added to the site front page or to [[My Moodle]].&lt;br /&gt;
&lt;br /&gt;
==Adding the Mentees block==&lt;br /&gt;
&lt;br /&gt;
To the site front page:&lt;br /&gt;
#On the site front page click &amp;quot;Turn editing on&amp;quot;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link&lt;br /&gt;
&lt;br /&gt;
To My Moodle:&lt;br /&gt;
#Access My Moodle configuration via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; [[Sticky blocks]]&#039;&#039;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link &lt;br /&gt;
&lt;br /&gt;
==Block visibility==&lt;br /&gt;
&lt;br /&gt;
The mentees block does not become visible until individual “mentors” have been assigned a role that enables them to mentor other users who become their &amp;quot;mentees&amp;quot; (e.g., a parent mentoring a child, or a tutor mentoring a student). To assign a mentor to a mentee, the mentor must first be assigned a role that allows that mentor permission to view relevant user information ([[Capabilities/moodle/user:viewdetails|moodle/user:viewdetails]] set to &#039;&#039;allow&#039;&#039;). After having been assigned a role that grants viewing permission, the mentor’s role must then be assigned to the mentee/user whose information they wish to view. &lt;br /&gt;
&lt;br /&gt;
Mentor users logging on to the site will then be presented with a mentees block containing names and links to information about the individual users the mentor has been granted authorization to view.&lt;br /&gt;
&lt;br /&gt;
==Example usage==&lt;br /&gt;
&lt;br /&gt;
The [[Parent role]] is an example of a role which utilizes the Mentees block.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Roles]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=57812 Create a Parent of a student role] forum discussion &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[fr:Bloc participants suivis]]&lt;br /&gt;
[[ja:メンティーブロック]]&lt;br /&gt;
[[ru:Подопечные (блок)]]&lt;br /&gt;
[[de:Mentoren_%28Block%29]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=76990</id>
		<title>Mentees block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=76990"/>
		<updated>2010-10-23T04:14:47Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 1.8}}&lt;br /&gt;
A &#039;&#039;&#039;Mentees block&#039;&#039;&#039; is...&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Mentees block&#039;&#039;&#039;, from Moodle 1.8 onwards, may be added to the site front page or to [[My Moodle]]. It provides a mentor with quick access to their mentee(s) profile page(s).&lt;br /&gt;
&lt;br /&gt;
==Adding the Mentees block==&lt;br /&gt;
&lt;br /&gt;
To the site front page:&lt;br /&gt;
#On the site front page click &amp;quot;Turn editing on&amp;quot;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link&lt;br /&gt;
&lt;br /&gt;
To My Moodle:&lt;br /&gt;
#Access My Moodle configuration via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; [[Sticky blocks]]&#039;&#039;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link &lt;br /&gt;
&lt;br /&gt;
==Block visibility==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The mentees block does not become visible until individual “mentors” have been assigned a role that enables them to mentor other users who become their &amp;quot;mentees&amp;quot; (e.g., a parent mentoring a child, or a tutor mentoring a student). To assign a mentor to a mentee, the mentor must first be assigned a role that allows that mentor permission to view relevant user information ([[Capabilities/moodle/user:viewdetails|moodle/user:viewdetails]] set to &#039;&#039;allow&#039;&#039;). After having been assigned a role that grants viewing permission, the mentor’s role must then be assigned to the mentee/user whose information they wish to view. &lt;br /&gt;
&lt;br /&gt;
Mentor users logging on to the site will then be presented with a mentees block containing names and links to information about the individual users the mentor has been granted authorization to view.&lt;br /&gt;
&lt;br /&gt;
==Example usage==&lt;br /&gt;
&lt;br /&gt;
The [[Parent role]] is an example of a role which utilizes the Mentees block.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Roles]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=57812 Create a Parent of a student role] forum discussion &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[fr:Bloc participants suivis]]&lt;br /&gt;
[[ja:メンティーブロック]]&lt;br /&gt;
[[ru:Подопечные (блок)]]&lt;br /&gt;
[[de:Mentoren_%28Block%29]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=76989</id>
		<title>Blocks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Blocks&amp;diff=76989"/>
		<updated>2010-10-23T04:13:23Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: starting a real definition...please help me out :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Course edit on new 4.JPG|thumb|right|Default block positions for a new course page]]&lt;br /&gt;
A &#039;&#039;&#039;block&#039;&#039;&#039; is ...&lt;br /&gt;
&lt;br /&gt;
A teacher can utilize many kinds of blocks in a course page. Typically a course home page contains blocks in the left and right columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Block types==&lt;br /&gt;
There are many different types of blocks in a course that can be used by a teacher. The teacher can add blocks from a pull down menu.  Other blocks provide information or settings that a teacher may use.  Some activities allow blocks to be inserted by the teacher.&lt;br /&gt;
&lt;br /&gt;
===Pull down===&lt;br /&gt;
Each course has an add block pull down menu.&lt;br /&gt;
{| border=&amp;quot;0&amp;quot;&lt;br /&gt;
| | &lt;br /&gt;
{| border=&amp;quot;2&amp;quot;;&amp;quot;&lt;br /&gt;
|[[Blogs|Blogs - Tags and Menu]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Calendar block|Calendar]] - display calendar&lt;br /&gt;
|-&lt;br /&gt;
|[[Global Search block]]&lt;br /&gt;
|-&lt;br /&gt;
|[[HTML block|HTML]] - Use HTML editor in content area&lt;br /&gt;
|-&lt;br /&gt;
|[[Loan calculator block|Loan Calculator]] (from 1.6 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Mentees block]] (from 1.8 onwards)&lt;br /&gt;
|-&lt;br /&gt;
|[[Messages block|Messages]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Online Users block|Online Users]] - only online Participants&lt;br /&gt;
|-&lt;br /&gt;
|[[People block|People]] - link to [[Participants]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Quiz Results]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Random Glossary Entry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Remote RSS Feeds]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Section Links]]&lt;br /&gt;
|}&lt;br /&gt;
| style=&amp;quot;width:100px&amp;quot; |  &lt;br /&gt;
|[[Image:Block add dropdown list teacher 1 8.JPG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Other blocks===&lt;br /&gt;
*[[Sticky blocks]] A block that is forced to appear on every page as part of a site setting&lt;br /&gt;
*[[Activities block|Activities]] A block used by teachers to add activities&lt;br /&gt;
*[[Course administration block]] contains course settings.&lt;br /&gt;
*[[Courses block|Courses]] Lists student&#039;s courses&lt;br /&gt;
*[[Course/Site Description block|Course/Site Description]] Teacher&#039;s description of course&lt;br /&gt;
*[[Latest News block|Latest News]]&lt;br /&gt;
*[[Recent Activity block|Recent Activity]]&lt;br /&gt;
*[[Search Forums block|Search Forums]]&lt;br /&gt;
*[[Upcoming Events block|Upcoming Events]]&lt;br /&gt;
&lt;br /&gt;
There are also many contributed blocks available for download from the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database] including:&lt;br /&gt;
&lt;br /&gt;
*[[Youtube block|Youtube]]&lt;br /&gt;
*[[Flickr block|Flickr]]&lt;br /&gt;
*[[Side bar block]]&lt;br /&gt;
*[[Progress Bar block]]&lt;br /&gt;
*[[Unanswered Discussions block]]&lt;br /&gt;
*[[Simple Clock block]]&lt;br /&gt;
&lt;br /&gt;
==Course page block arrangement==&lt;br /&gt;
[[Image:Block_People.JPG |frame|The People block with editing turned on]]&lt;br /&gt;
Teachers, and other users with the capability to manage course activities, can change the arrangement of blocks on the course page (apart from [[Sticky blocks]]) when editing is turned on.&lt;br /&gt;
&lt;br /&gt;
New blocks can be added using the Add blocks dropdown menu. Existing blocks (apart from [[Sticky blocks]]) can be hidden, deleted or moved using the icons in the block header.&lt;br /&gt;
&lt;br /&gt;
==Adding blocks to activities==&lt;br /&gt;
Certain activity modules, such as the [[Lesson module]] and the [[Quiz module]], support blocks on their pages. The site administrator must turn this function on so that the teachers will be able to add side blocks on those pages, otherwise the interface does not show this feature to the teacher.&lt;br /&gt;
&lt;br /&gt;
By default, this feature is disabled in the [[Site administration block]]. An administrator can enable it by checking the &#039;&#039;showblocksonmodpages&#039;&#039; box in &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings&#039;&#039;.  When enabled, users who can manage course activities will be able to add blocks to pages.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Blocks FAQ]]&lt;br /&gt;
*[[Block permissions]]&lt;br /&gt;
*[[Blocks administration]] - site block settings that an administrator can use&lt;br /&gt;
*[[Site administration block]]&lt;br /&gt;
*[[Development:Blocks]] - a developer guide to creating blocks&lt;br /&gt;
*[[:Category:Block]] - an index of all block-related pages&lt;br /&gt;
*[[:Category:Contributed code]] including a number of contributed blocks&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2121 Blocks forum]&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
[[de:Blöcke]]&lt;br /&gt;
[[eu:Irakaslearen_blokeak]]&lt;br /&gt;
[[fr:Blocs (enseignant)]]&lt;br /&gt;
[[ja:ブロック]]&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=76988</id>
		<title>Development talk:Roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development_talk:Roles&amp;diff=76988"/>
		<updated>2010-10-23T04:10:16Z</updated>

		<summary type="html">&lt;p&gt;Wmasterj: /* Let&amp;#039;s start a new guideline for the wiki */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chris, I put back the forum moderator example. I think it was intentional. We want to get people thinking outside the box of what previous versions were capable of.&lt;br /&gt;
&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The list of capabilities for some activities should include viewing as a separate capability since it is a distinct action from editing or taking part, for example&lt;br /&gt;
&lt;br /&gt;
choice_canviewresults&lt;br /&gt;
&lt;br /&gt;
== legacy support for isstudent() and isteacher() ==&lt;br /&gt;
&lt;br /&gt;
We could provide legacy support for modules (and core) to continue using isstudent() and isteacher() calls, by replacing these with stubs that simply wrap the new access control API and feed in the proper parameters. This might help reduce the initial effort (i.e., you don&#039;t HAVE to update every. single. module. at first, just the ones most affected by this API change. then, as time allows, and as modules are being updated anyway, migrate them to the new API)&lt;br /&gt;
&lt;br /&gt;
almost forgot - totally looking forward to this feature. any ETA?&lt;br /&gt;
&lt;br /&gt;
== What are the legacy capabilities for? ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve been reading the Roles documentation, and my a lot of work going on in here! Keep it up! I might be understanding something incorrectly as I can&#039;t figure out what the legacy capabilities are for? I thought that Roles are sets of capabilities. There might/should be Roles for all of the &amp;quot;legacy roles&amp;quot;, which would then have the default set of capabilities matching the capabilities in 1.6. What are the &amp;quot;legacy capabilities&amp;quot; then? --[[User:Samuli Karevaara|Samuli Karevaara]] 07:27, 1 September 2006 (CDT)&lt;br /&gt;
:No answer yet... This was also asked in the [http://moodle.org/mod/forum/discuss.php?d=61269 forums]. --[[User:Samuli Karevaara|Samuli Karevaara]] 04:43, 18 January 2007 (CST)&lt;br /&gt;
&lt;br /&gt;
== Page too long? ==&lt;br /&gt;
&lt;br /&gt;
I think this page is a bit too long and could profit from some refactoring, for example reducing some redundancies with other pages like [[Development:Roles and modules]] or integrating [[Development:Local customisation]]. --[[User:Frank Ralf|Frank Ralf]] 17:14, 27 March 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Let&#039;s start a new guideline for the wiki ==&lt;br /&gt;
&lt;br /&gt;
I am a new user and developer for Moodle at the University of Washington and time and time again I get frustrated about the use of first person everywhere:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;I added these questions here because...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Who cares about you? I suggest a new guideline that encourages everyone to write more like:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Here follows a questions section, the reason we have it is...&amp;quot; &lt;br /&gt;
&lt;br /&gt;
I get pretty turned of myself to edit any documentation in this Wiki because there are so many &amp;quot;I&amp;quot;&#039;s everywhere that it seems like one or two people are editing everything and if I do any thing to it that person would get upset. This is wrong an is an inhibitor to the fact that you probably want loads of people adding to and editing the wiki. Since I am new, please forward this to some wiki admin who can take this into consideration and add to a guideline somewhere (i don&#039;t know where they are).&lt;br /&gt;
&lt;br /&gt;
Thanks --[[User:Jeroen van den Eijkhof|Jeroen van den Eijkhof]] 04:10, 23 October 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Wmasterj</name></author>
	</entry>
</feed>