Dear Mantis developers and advanced users,
Despite the fact that the subject of custom email notifications was discussed on many articles on the web I humbly ask you to look at this again...
I have download the latest version of mantis - 1.2.12
I went through
http://www.mantisbt.org/docs/master/en/ ... lding.html
http://www.mantisbt.org/wiki/doku.php/m ... cow_powers
http://bugtracker.morinie.fr/mantis/dok ... e_a_plugin
and I managed to create a plugin that echos word 'ass' on the main page trigered by EVENT_CORE_READY event...
I would like to make my plugin a little bit more useful, namely:
I would like my plugin to send a custom email with custom content to custem email - specified in code/config file; through a remote SMTP with custom credentials. I want this email to be send when bug ticket changes its 'state'? to 'resolved'...
How to achieve such functionality?
Plugin for custom email notifications
Moderators: Developer, Contributor
Re: Plugin for custom email notifications
You should ignore this information as it is a non standard 3rd party plugin system for MantisBT 1.1.x, not for MantisBT 1.2.xmentis wrote: http://bugtracker.morinie.fr/mantis/dok ... e_a_plugin
I recommend to study some of the plugins hosted at https://github.com/mantisbt-plugins
-
mentis
Re: Plugin for custom email notifications
Thank you for your replay,
Is this event reference still valid?
http://www.mantisbt.org/wiki/doku.php/m ... ins_events
I couldn't find
anywhere in mantis folder...
if those events are no longer valid, what is the current equivalent?
Is this event reference still valid?
http://www.mantisbt.org/wiki/doku.php/m ... ins_events
I couldn't find
Code: Select all
EVENT_BUG_REPORTED ( Execute ) - Triggered when a new bug has been reported.
EVENT_BUG_UPDATED ( Execute ) - Triggered when a bug has been updated.
EVENT_BUG_RESOLVED ( Execute ) - Triggered when a bug is resolved.
EVENT_BUG_CLOSED ( Execute ) - Triggered when a bug has been closed
EVENT_BUG_NOTE_ADDED ( Execute ) - Triggered when a bugnote has been added to a bug. Is this superfluous because of EVENT_BUG_UPDATED?
if those events are no longer valid, what is the current equivalent?
Re: Plugin for custom email notifications
The one and only valid documentation is the source code 
Have a look at core/events_inc.php for the events.
The Wiki has been written as a specification before the implementation
Have a look at core/events_inc.php for the events.
The Wiki has been written as a specification before the implementation
Search for event_signal in MantisBT code to see where the events are triggered.NOTE: The event list has not yet been finalized. You should not rely on this reference until events have been fully implemented.
-
mentis
Re: Plugin for custom email notifications
I'm puzzled X_x
What event is triggered when user changes status of a bug for example from 'new' to 'resolved' ?
How to hook to this event?
Is EVENT_UPDATE_BUG the one ?
how do I hook to it ?
this doesn't work ;(
is BugData passed along with one of those events? Should I / Can I compare to bug_data->status ?
What event is triggered when user changes status of a bug for example from 'new' to 'resolved' ?
How to hook to this event?
Is EVENT_UPDATE_BUG the one ?
how do I hook to it ?
Code: Select all
function hooks()
{
$hooks = array(
'EVENT_UPDATE_BUG' => 'bug_fun',
);
return $hooks;
}
function bug_fun( $p_event, $p_bug_data, $p_bug_id ) {
echo '<br/>';
echo 'fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
echo '<br/>';
}
is BugData passed along with one of those events? Should I / Can I compare to bug_data->status ?
Re: Plugin for custom email notifications
Have a look at this plugin function update_bug
https://github.com/vincentsels/ProjectM ... gement.php
Search for
https://github.com/vincentsels/ProjectM ... gement.php
Search for
Code: Select all
if ( $p_bug_data->status >= config_get( 'bug_resolved_status_threshold' ) ) {
-
mentis
Re: Plugin for custom email notifications
ok, so the hook works but wont echo, it will create a file...
output:
how to get useful data out of it? data i could populate an email with?
Code: Select all
function bug_fun($p_event, $p_params) {
echo '<br/>';
echo $p_params->status;
echo '<br/>';
echo 'fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
echo '<br/>';
$ourFileName = "dyzurny.txt";
$fh = fopen($ourFileName, 'w') or die("can't open file");
fwrite($fh, $p_params->project_id . "\n");
fwrite($fh, $p_params->reporter_id . "\n");
fwrite($fh, $p_params->build . "\n");
fwrite($fh, $p_params->platform . "\n");
fwrite($fh, $p_params->os . "\n");
fwrite($fh, $p_params->os_build . "\n");
fwrite($fh, $p_params->version . "\n");
fwrite($fh, $p_params->profile_id . "\n");
fwrite($fh, $p_params->handler_id . "\n");
fwrite($fh, $p_params->view_state . "\n");
fwrite($fh, $p_params->category_id . "\n");
fwrite($fh, $p_params->reproductibility . "\n");
fwrite($fh, $p_params->severity . "\n");
fwrite($fh, $p_params->priority . "\n");
fwrite($fh, $p_params->projection . "\n");
fwrite($fh, $p_params->eta . "\n");
fwrite($fh, $p_params->resolution . "\n");
fwrite($fh, $p_params->status . "\n");
fwrite($fh, $p_params->summary . "\n");
fwrite($fh, $p_params->description . "\n");
fwrite($fh, $p_params->steps_to_reproduce . "\n");
fwrite($fh, $p_params->additional_information . "\n");
fclose($fh);
}Code: Select all
3
1
0
1
10
1
50
30
10
10
20
20
werwer
werwer
Re: Plugin for custom email notifications
Sorry, I don't have time to give you step by step instructions.
You have to learn the concecpt of enumerations in MantisBT http://www.mantisbt.org/docs/master-1.2 ... MIZE.ENUMS
Have a look at file bug_view_inc.php around line 175 how to get displayable values from enums (get_enum_element)
You have to learn the concecpt of enumerations in MantisBT http://www.mantisbt.org/docs/master-1.2 ... MIZE.ENUMS
Have a look at file bug_view_inc.php around line 175 how to get displayable values from enums (get_enum_element)
-
mentis
Re: Plugin for custom email notifications
Thank you very, very much for all your help
I finished my pluging, it works as I wanted
I finished my pluging, it works as I wanted