<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lfrodrigues</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lfrodrigues"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Lfrodrigues"/>
	<updated>2026-04-25T21:45:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11303</id>
		<title>Messaging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11303"/>
		<updated>2008-09-25T17:42:34Z</updated>

		<summary type="html">&lt;p&gt;Lfrodrigues: /* Sending a Message */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Messageing API is a new core system in Moodle to allow communication of messages to users. It&#039;s based on the events system, so a module will trigger an event with the attached message data and the message output processor will try to deliver the message to the correct place.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Setting up a provider===&lt;br /&gt;
* db/messages.php (list the types of providers)&lt;br /&gt;
* /lang/XX/messages/providercomponent_providername.html (documentation)&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
===Setting up a processor===&lt;br /&gt;
&lt;br /&gt;
===Sending a Message===&lt;br /&gt;
&lt;br /&gt;
Whenever you need to send a message, it should “tell” the system about it.   So, using the message as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;component        = &amp;quot;message&amp;quot;;&lt;br /&gt;
 $eventdata-&amp;gt;name             = &amp;quot;instantmessage&amp;quot;;&lt;br /&gt;
 $eventdata-&amp;gt;userfrom         = $userfrom;&lt;br /&gt;
 $eventdata-&amp;gt;userto           = $userto;&lt;br /&gt;
 $eventdata-&amp;gt;subject          = &amp;quot;IM&amp;quot;;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessage      = $message;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessageformat = FORMAT_PLAIN;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessagehtml  = &amp;quot;&amp;quot;;&lt;br /&gt;
 $eventdata-&amp;gt;smallmessage     = &amp;quot;&amp;quot;; &lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;message_send&#039;, $eventdata);&lt;/div&gt;</summary>
		<author><name>Lfrodrigues</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11302</id>
		<title>Messaging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11302"/>
		<updated>2008-09-25T17:41:57Z</updated>

		<summary type="html">&lt;p&gt;Lfrodrigues: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Messageing API is a new core system in Moodle to allow communication of messages to users. It&#039;s based on the events system, so a module will trigger an event with the attached message data and the message output processor will try to deliver the message to the correct place.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Setting up a provider===&lt;br /&gt;
* db/messages.php (list the types of providers)&lt;br /&gt;
* /lang/XX/messages/providercomponent_providername.html (documentation)&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
===Setting up a processor===&lt;br /&gt;
&lt;br /&gt;
===Sending a Message===&lt;br /&gt;
&lt;br /&gt;
Whenever you need to send a message, it should “tell” the system about it.   So, using the message as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;component        = &#039;message&#039;;&lt;br /&gt;
 $eventdata-&amp;gt;name             = &#039;instantmessage&#039;;&lt;br /&gt;
 $eventdata-&amp;gt;userfrom         = $userfrom;&lt;br /&gt;
 $eventdata-&amp;gt;userto           = $userto;&lt;br /&gt;
 $eventdata-&amp;gt;subject          = &amp;quot;IM&amp;quot;;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessage      = $message;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessageformat = FORMAT_PLAIN;&lt;br /&gt;
 $eventdata-&amp;gt;fullmessagehtml  = &#039;&#039;;&lt;br /&gt;
 $eventdata-&amp;gt;smallmessage     = &#039;&#039;; &lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;message_send&#039;, $eventdata);&lt;/div&gt;</summary>
		<author><name>Lfrodrigues</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11301</id>
		<title>Messaging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11301"/>
		<updated>2008-09-25T16:31:02Z</updated>

		<summary type="html">&lt;p&gt;Lfrodrigues: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Messageing API is a new core system in Moodle to allow communication of messages to users. It&#039;s based on the events system, so a module will trigger an event with the attached message data and the message output processor will try to deliver the message to the correct place.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files to Create==&lt;br /&gt;
/db/messages.php (list the types of providers)&lt;br /&gt;
/lang/XX/messages/providercomponent_providername.html (documentation)&lt;br /&gt;
...&lt;/div&gt;</summary>
		<author><name>Lfrodrigues</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11300</id>
		<title>Messaging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Messaging&amp;diff=11300"/>
		<updated>2008-09-25T13:30:32Z</updated>

		<summary type="html">&lt;p&gt;Lfrodrigues: New page: The Messageing API is a new core system in Moodle to allow communication of messages to users. It&amp;#039;s based on the events system, so a module will trigger an event with the attached message ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Messageing API is a new core system in Moodle to allow communication of messages to users. It&#039;s based on the events system, so a module will trigger an event with the attached message data and the message output processor will try to deliver the message to the correct place.&lt;/div&gt;</summary>
		<author><name>Lfrodrigues</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Activity_modules&amp;diff=713</id>
		<title>Activity modules</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Activity_modules&amp;diff=713"/>
		<updated>2007-06-18T17:50:00Z</updated>

		<summary type="html">&lt;p&gt;Lfrodrigues: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Activity modules&#039;&#039;&#039; reside in the &#039;mod&#039; directory. Each module is in a separate subdirectory and consists of the following mandatory elements (plus extra scripts unique to each module):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod.html&#039;&#039; - a form to set up or update an instance of this module&lt;br /&gt;
* &#039;&#039;version.php&#039;&#039; - defines some meta-info and provides upgrading code&lt;br /&gt;
* &#039;&#039;icon.gif&#039;&#039; - a 16x16 icon for the module&lt;br /&gt;
* &#039;&#039;db/&#039;&#039; - SQL dumps of all the required db tables and data (for each database type)&lt;br /&gt;
* &#039;&#039;index.php&#039;&#039; - a page to list all instances in a course&lt;br /&gt;
* &#039;&#039;view.php&#039;&#039; - a page to view a particular instance&lt;br /&gt;
* &#039;&#039;lib.php&#039;&#039; - any/all functions defined by the module should be in here. If the modulename is called widget, then the required functions include:&lt;br /&gt;
:* widget_install() - will be called during the installation of the module&lt;br /&gt;
:* widget_add_instance() - code to add a new instance of widget&lt;br /&gt;
:* widget_update_instance() - code to update an existing instance&lt;br /&gt;
:* widget_delete_instance() - code to delete an instance&lt;br /&gt;
:* widget_user_outline() - given an instance, return a summary of a user&#039;s contribution&lt;br /&gt;
:* widget_user_complete() - given an instance, print details of a user&#039;s contribution&lt;br /&gt;
:* Other functions available but not required are:&lt;br /&gt;
:** widget_delete_course() - code to clean up anything that would be leftover after all instances are deleted&lt;br /&gt;
:** widget_process_options() - code to pre-process the form data from module settings&lt;br /&gt;
:* To avoid possible conflict, any module functions should be named starting with widget_ and any constants you define should start with WIDGET_&lt;br /&gt;
* &#039;&#039;config.html&#039;&#039; - (optional) a form to set up or update global settings of this module&lt;br /&gt;
* Lastly, each module will have some language files that contain strings for that module.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT: When creating a new module, the new name of the module must not contain numbers or other special characters! &lt;br /&gt;
&lt;br /&gt;
You should also make sure that your activity module provides appropriate support for groups and metacourses. &lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* http://download.moodle.org/download.php/modules/NEWMODULE.zip - new module template for starting module development. Please follow the README instructions inside the zip.&lt;br /&gt;
* Using Moodle [http://moodle.org/course/view.php?id=5 Activity modules] forum&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=66165 A new resource type: where do I put the language strings?] forum discussion&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=65986 New Module Template Code for Moodle 1.7] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
&lt;br /&gt;
[[es:Módulos de actividades (desarrollador)]]&lt;br /&gt;
[[ja:モジュール (開発者)]]&lt;/div&gt;</summary>
		<author><name>Lfrodrigues</name></author>
	</entry>
</feed>