Skip to content

Commit b292ef1

Browse files
committedApr 19, 2013
Add plugin event for e-mail subject customization
New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT Fixes #15648
1 parent 815a4e4 commit b292ef1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
 

‎core/email_api.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -1091,10 +1091,16 @@ function email_build_subject( $p_bug_id ) {
10911091
# grab the subject (summary)
10921092
$p_subject = bug_get_field( $p_bug_id, 'summary' );
10931093

1094-
# padd the bug id with zeros
1095-
$p_bug_id = bug_format_id( $p_bug_id );
1094+
# pad the bug id with zeros
1095+
$t_bug_id = bug_format_id( $p_bug_id );
10961096

1097-
return '[' . $p_project_name . ' ' . $p_bug_id . ']: ' . $p_subject;
1097+
# build standard subject string
1098+
$t_email_subject = "[$p_project_name $t_bug_id]: $p_subject";
1099+
1100+
# update subject as defined by plugins
1101+
$t_email_subject = event_signal( 'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT', $t_email_subject, array( 'bug_id' => $p_bug_id ) );
1102+
1103+
return $t_email_subject;
10981104
}
10991105

11001106
/**
@@ -1207,7 +1213,7 @@ function email_bug_info_to_one_user( $p_visible_bug_data, $p_message_id, $p_proj
12071213
}
12081214

12091215
# build subject
1210-
$t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id( $p_visible_bug_data['email_bug'] ) . ']: ' . $p_visible_bug_data['email_summary'];
1216+
$t_subject = email_build_subject($p_visible_bug_data['email_bug']);
12111217

12121218
# build message
12131219

‎core/events_inc.php

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'EVENT_DISPLAY_FORMATTED' => EVENT_TYPE_CHAIN,
4242
'EVENT_DISPLAY_RSS' => EVENT_TYPE_CHAIN,
4343
'EVENT_DISPLAY_EMAIL' => EVENT_TYPE_CHAIN,
44+
'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT' => EVENT_TYPE_CHAIN,
4445

4546
# Menu Events
4647
'EVENT_MENU_MAIN' => EVENT_TYPE_DEFAULT,

0 commit comments

Comments
 (0)
Please sign in to comment.