<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?action=history&amp;feed=atom&amp;title=Sending_user_messages</id>
	<title>Sending user messages - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?action=history&amp;feed=atom&amp;title=Sending_user_messages"/>
	<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Sending_user_messages&amp;action=history"/>
	<updated>2026-05-10T18:25:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Sending_user_messages&amp;diff=11986&amp;oldid=prev</id>
		<title>Alan.stiles@open.ac.uk: added an eprints version section</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Sending_user_messages&amp;diff=11986&amp;oldid=prev"/>
		<updated>2016-05-17T15:18:30Z</updated>

		<summary type="html">&lt;p&gt;added an eprints version section&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:18, 17 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Tested in EPrints versions ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3.3.10 - 2016-05-17&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Why==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Why==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When you execute a job asynchronously (e.g. as a timed event) you may wish to inform the user of the job&amp;#039;s completion.  You may also wish to warn the user should something not be configured correctly or if the job failed.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When you execute a job asynchronously (e.g. as a timed event) you may wish to inform the user of the job&amp;#039;s completion.  You may also wish to warn the user should something not be configured correctly or if the job failed.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l42&quot;&gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 46:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Snippets]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Snippets]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alan.stiles@open.ac.uk</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Sending_user_messages&amp;diff=11985&amp;oldid=prev</id>
		<title>Alan.stiles@open.ac.uk: Created page with &quot;==Why== When you execute a job asynchronously (e.g. as a timed event) you may wish to inform the user of the job&#039;s completion.  You may also wish to warn the user should somet...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Sending_user_messages&amp;diff=11985&amp;oldid=prev"/>
		<updated>2016-05-17T15:14:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Why== When you execute a job asynchronously (e.g. as a timed event) you may wish to inform the user of the job&amp;#039;s completion.  You may also wish to warn the user should somet...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Why==&lt;br /&gt;
When you execute a job asynchronously (e.g. as a timed event) you may wish to inform the user of the job&amp;#039;s completion.  You may also wish to warn the user should something not be configured correctly or if the job failed.&lt;br /&gt;
This could either be achieved by sending the user an email (Assuming you have an email address) or by sending them a message within EPrints.&lt;br /&gt;
&lt;br /&gt;
There are 2 places I have encountered user messages thus far - within Plugin Screen actions and from a CGI script.  The method for each is similar but not the same.  Both require:&lt;br /&gt;
a type of message &lt;br /&gt;
  *message - informational/positive (default coloured green)&lt;br /&gt;
  *warning - alert to some non-critical issue (default coloured orange)&lt;br /&gt;
  *error - alert to something critical, like a communications error&lt;br /&gt;
&lt;br /&gt;
a message body, as a DOM object.  This could be via $self-&amp;gt;{repository}-&amp;gt;make_text(&amp;quot;Some Text&amp;quot;) or a call to a defined phrase within the repository.&lt;br /&gt;
&lt;br /&gt;
==Screen plugin action==&lt;br /&gt;
within a screen plugin action, you can send a message to the current user with via the screen processor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;perl&amp;quot;&amp;gt;&lt;br /&gt;
sub action_screen_action&lt;br /&gt;
{&lt;br /&gt;
  my ( $self ) = @_;&lt;br /&gt;
  $self-&amp;gt;{processor}-&amp;gt;add_message(&lt;br /&gt;
            &amp;quot;error&amp;quot;,   #message type - one of &amp;#039;message&amp;#039;, &amp;#039;warning&amp;#039; or &amp;#039;error&amp;#039;&lt;br /&gt;
            $self-&amp;gt;{repository}-&amp;gt;make_text(&amp;quot;No EPrint found with ID: $eprint_id&amp;quot;),   # the body of the message as a DOM object&lt;br /&gt;
  );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==CGI Script (and other non-screen functions)==&lt;br /&gt;
From a CGI script, you can send a message to a user via the repository object, as such you need to specify the user, which need not be the current user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;perl&amp;quot;&amp;gt;&lt;br /&gt;
  my $repository = new EPrints::Session;&lt;br /&gt;
  my $db = $repository-&amp;gt;database;&lt;br /&gt;
  my $current_user = $repository-&amp;gt;current_user();&lt;br /&gt;
  $db-&amp;gt;save_user_message(&lt;br /&gt;
            $current_user-&amp;gt;get_value( &amp;quot;userid&amp;quot; ),   #Userid to receive the message&lt;br /&gt;
            &amp;quot;message&amp;quot;,                              #Message type&lt;br /&gt;
            $repo-&amp;gt;html_phrase(&amp;quot;some_phrase_identifier&amp;quot;, (              #the message body, in this instance a phrase identifier&lt;br /&gt;
                        &amp;quot;name&amp;quot; =&amp;gt; $current_user-&amp;gt;render_value( &amp;quot;name&amp;quot; ) # pin name/value pairs as required for the phrase;&lt;br /&gt;
                        )&lt;br /&gt;
            )&lt;br /&gt;
  );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Snippets]]&lt;/div&gt;</summary>
		<author><name>Alan.stiles@open.ac.uk</name></author>
	</entry>
</feed>