<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hallo Yuri,
<div class=""><br class="">
</div>
<div class="">tnks for the Infos. I thing I found a different way, with less code-changing. I am still testing it. &nbsp;I modified a bit the :</div>
<div class="">
<h2 style="background-image: none; font-weight: normal; margin: 1em 0px 0.25em; overflow: hidden; padding: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(170, 170, 170); font-family: sans-serif; line-height: 1.3;" class="">
<span class="mw-headline" id="CGI_Script_.28and_other_non-screen_functions.29">CGI Script (and other non-screen functions)</span></h2>
<div style="margin: 0.5em 0px; line-height: inherit; caret-color: rgb(37, 37, 37); color: rgb(37, 37, 37); font-family: sans-serif; font-size: 14px;" class="">
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:</div>
<div dir="ltr" class="mw-code mw-geshi mw-content-ltr" style="direction: ltr; font-family: monospace, Courier; padding: 1em; border: 1px solid rgb(221, 221, 221); background-color: rgb(249, 249, 249); line-height: 1.3em; font-size: 14px;">
<div class="source-perl perl" style="padding: 10px 15px; margin-left: 2em; border: 1px solid rgb(136, 136, 136); background-color: rgb(238, 238, 238); overflow: auto; font-size: 14.21875px; line-height: normal; font-family: monospace;">
<pre class="de1" style="font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; font-stretch: normal; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top;">  <span class="kw1" style="color: rgb(177, 177, 0);">my</span> <span class="re0" style="color: rgb(0, 0, 255);">$repository</span> <span class="sy0" style="color: rgb(51, 153, 51);">=</span> <span class="kw2" style="font-weight: bold;">new</span> EPrints<span class="sy0" style="color: rgb(51, 153, 51);">::</span><span class="me2" style="color: rgb(0, 102, 0);">Session</span><span class="sy0" style="color: rgb(51, 153, 51);">;</span>
  <span class="kw1" style="color: rgb(177, 177, 0);">my</span> <span class="re0" style="color: rgb(0, 0, 255);">$db</span> <span class="sy0" style="color: rgb(51, 153, 51);">=</span> <span class="re0" style="color: rgb(0, 0, 255);">$repository</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">database</span><span class="sy0" style="color: rgb(51, 153, 51);">;</span>
  <span class="kw1" style="color: rgb(177, 177, 0);">my</span> <span class="re0" style="color: rgb(0, 0, 255);">$current_user</span> <span class="sy0" style="color: rgb(51, 153, 51);">=</span> <span class="re0" style="color: rgb(0, 0, 255);">$repository</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">current_user</span><span class="br0" style="color: rgb(0, 153, 0);">(</span><span class="br0" style="color: rgb(0, 153, 0);">)</span><span class="sy0" style="color: rgb(51, 153, 51);">;</span>
  <span class="re0" style="color: rgb(0, 0, 255);">$db</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">save_user_message</span><span class="br0" style="color: rgb(0, 153, 0);">(</span>
            <span class="re0" style="color: rgb(0, 0, 255);">$current_user</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">get_value</span><span class="br0" style="color: rgb(0, 153, 0);">(</span> <span class="st0" style="color: rgb(255, 0, 0);">&quot;userid&quot;</span> <span class="br0" style="color: rgb(0, 153, 0);">)</span><span class="sy0" style="color: rgb(51, 153, 51);">,</span>   <span class="co1" style="color: rgb(102, 102, 102); font-style: italic;">#Userid to receive the message</span>
            <span class="st0" style="color: rgb(255, 0, 0);">&quot;message&quot;</span><span class="sy0" style="color: rgb(51, 153, 51);">,</span>                              <span class="co1" style="color: rgb(102, 102, 102); font-style: italic;">#Message type</span>
            <span class="re0" style="color: rgb(0, 0, 255);">$repo</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">html_phrase</span><span class="br0" style="color: rgb(0, 153, 0);">(</span><span class="st0" style="color: rgb(255, 0, 0);">&quot;some_phrase_identifier&quot;</span><span class="sy0" style="color: rgb(51, 153, 51);">,</span> <span class="br0" style="color: rgb(0, 153, 0);">(</span>              <span class="co1" style="color: rgb(102, 102, 102); font-style: italic;">#the message body, in this instance a phrase identifier</span>
                        <span class="st0" style="color: rgb(255, 0, 0);">&quot;name&quot;</span> <span class="sy0" style="color: rgb(51, 153, 51);">=&gt;</span> <span class="re0" style="color: rgb(0, 0, 255);">$current_user</span><span class="sy0" style="color: rgb(51, 153, 51);">-&gt;</span><span class="me1" style="color: rgb(0, 102, 0);">render_value</span><span class="br0" style="color: rgb(0, 153, 0);">(</span> <span class="st0" style="color: rgb(255, 0, 0);">&quot;name&quot;</span> <span class="br0" style="color: rgb(0, 153, 0);">)</span> <span class="co1" style="color: rgb(102, 102, 102); font-style: italic;"># pin name/value pairs as required for the phrase;</span>
                        <span class="br0" style="color: rgb(0, 153, 0);">)</span>
            <span class="br0" style="color: rgb(0, 153, 0);">)</span>
  <span class="br0" style="color: rgb(0, 153, 0);">)</span><span class="sy0" style="color: rgb(51, 153, 51);">;</span></pre>
</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">And it looks like it will work fine.&nbsp;</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Regards</div>
<div class=""><br class="">
</div>
<div class="">A.</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">Am 22.04.2020 um 10:56 schrieb Yuri Carrer via Eprints-tech &lt;<a href="mailto:eprints-tech@ecs.soton.ac.uk" class="">eprints-tech@ecs.soton.ac.uk</a>&gt;:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class=""><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FSending_user_messages&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cac0bbc9f4871480c3d4308d7e6a131b5%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=e34vrrmD6xsD4nzdm6u31CZVaa6sWETX8vAnOpjN3DQ%3D&amp;reserved=0" originalSrc="https://wiki.eprints.org/w/Sending_user_messages" shash="MlwZtl0d8kkCGLY+kPsJfUY+qbX0o4jQ1nwKSeVNhy/edvr0tIuOnPgZgDRT+VdijB/euFtKftRNDxyALFBVYworfu7Gxq2OZ8RaNDN0BpFKOHXkpMl00dK2GjtiRjM3a617RTORIWOcSqeQSh/DiO+hXg1hNPsu4WDDGVw83gc=" class="">https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FSending_user_messages&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=RehnUeiDgMdHcznQaaC931dwysLPl1gf0%2FHjXw8ORHQ%3D&amp;amp;reserved=0</a><br class="">
<br class="">
you want the message if the user clicked a button on screen, the link<br class="">
you cited act on a status change which is instead an asyncronous<br class="">
operation (it is performed outside the page flow).<br class="">
<br class="">
You've to replace the actual screen action (for example &quot;Move to the<br class="">
repository&quot; which is EPrint::Move (*)) with another one that perform the<br class="">
add_message() after calling the action directly<br class="">
<br class="">
(*)<br class="">
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Fperl_lib%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FMove.pm&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=a2CqU3kzjM9YJhJ6lznG7NZ7Li9Lrn9o67AQlyCws5Y%3D&amp;amp;reserved=0<br class="">
<br class="">
sub action_move_archive<br class="">
{<br class="">
&nbsp;&nbsp;&nbsp; my( $self ) = @_;<br class="">
<br class="">
&nbsp;&nbsp;&nbsp; my $ok = $self-&gt;{processor}-&gt;{eprint}-&gt;move_to_archive;<br class="">
<br class="">
&nbsp;&nbsp;&nbsp; $self-&gt;add_result_message( $ok );<br class="">
}<br class="">
<br class="">
$self-&gt;{processor}-&gt;{eprint}-&gt;move_to_archive perform the status change<br class="">
and activate the trigger but you can't know about trigger result because<br class="">
it is done elsewhere (the epindexer deamon!) &lt;- important!<br class="">
<br class="">
At the end, you've to add the event (not the trigger, take a look to the<br class="">
doi datacite plugin on how to do it (*)) in the code of in the screen<br class="">
plugin and then the event, when triggered, will have the pluginid and<br class="">
action set, so you can check where the triggered event came from, and<br class="">
send/not send the email based on your logic.<br class="">
<br class="">
(*)<br class="">
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprintsug%2FDataCiteDoi%2Fblob%2Fmaster%2Flib%2Fplugins%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FStaff%2FCoinDOI.pm%23L97&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=3WDaB11ISXtACDrhhR0kMijqkYhEnmht4Wu80S%2Bw0Xs%3D&amp;amp;reserved=0<br class="">
<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $repository-&gt;dataset( &quot;event_queue&quot; )-&gt;create_dataobj({<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pluginid =&gt; &quot;Event::DataCiteEvent&quot;,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; action =&gt; &quot;datacite_doi&quot;,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; params =&gt; [$eprint-&gt;internal_uri],<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }); &lt;- here replace with Eprint::Move and move_to_archive<br class="">
<br class="">
Il 22/04/20 10:05, Stenger, Avischai via Eprints-tech ha scritto:<br class="">
<blockquote type="cite" class="">Hi 2 all,<br class="">
<br class="">
I am using this Method: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FSending_email_when_item_is_made_live_or_deposited&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=FbbvFiV2IoxAcRUihEE7SKtrQepyA%2BjDEB3q2KnNdLY%3D&amp;amp;reserved=0<br class="">
<br class="">
And it work fine, but I cannot get a „mailsend_OK /mailsend_Not_OK“ &nbsp;message to be shown on the user Screen. How do I get this done? I find no „object&quot; with the add_message() funtion<br class="">
<br class="">
<br class="">
Tnks and a healthy day<br class="">
<br class="">
<br class="">
avi<br class="">
<br class="">
<br class="">
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech<br class="">
*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=hFRTukNerDhcESNLO%2BywJgQyKCpGWlJAQMtBIGguE90%3D&amp;amp;reserved=0<br class="">
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C496f63bb97774165247208d7e69b09ad%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=sKe2DiLjnSg6ClwtV6wdrqP%2Bxg9K6r8YTvLBN53tQCI%3D&amp;amp;reserved=0<br class="">
</blockquote>
<br class="">
--<br class="">
Yuri Carrer<br class="">
<br class="">
&nbsp;CAB - Centro di Ateneo per le Biblioteche, Università di Padova<br class="">
&nbsp;Tel: 049/827 9712 - Via Beato Pellegrino, 28 - Padova<br class="">
<br class="">
<br class="">
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech<br class="">
*** Archive: http://www.eprints.org/tech.php/<br class="">
*** EPrints community wiki: http://wiki.eprints.org/</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>