Skip to content

Commit

Permalink
Add plugin event for e-mail subject customization
Browse files Browse the repository at this point in the history
New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT

Fixes #15648
  • Loading branch information
dregad committed Apr 19, 2013
1 parent 815a4e4 commit b292ef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/email_api.php
Expand Up @@ -1091,10 +1091,16 @@ function email_build_subject( $p_bug_id ) {
# grab the subject (summary)
$p_subject = bug_get_field( $p_bug_id, 'summary' );

# padd the bug id with zeros
$p_bug_id = bug_format_id( $p_bug_id );
# pad the bug id with zeros
$t_bug_id = bug_format_id( $p_bug_id );

return '[' . $p_project_name . ' ' . $p_bug_id . ']: ' . $p_subject;
# build standard subject string
$t_email_subject = "[$p_project_name $t_bug_id]: $p_subject";

# update subject as defined by plugins
$t_email_subject = event_signal( 'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT', $t_email_subject, array( 'bug_id' => $p_bug_id ) );

return $t_email_subject;
}

/**
Expand Down Expand Up @@ -1207,7 +1213,7 @@ function email_bug_info_to_one_user( $p_visible_bug_data, $p_message_id, $p_proj
}

# build subject
$t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id( $p_visible_bug_data['email_bug'] ) . ']: ' . $p_visible_bug_data['email_summary'];
$t_subject = email_build_subject($p_visible_bug_data['email_bug']);

# build message

Expand Down
1 change: 1 addition & 0 deletions core/events_inc.php
Expand Up @@ -41,6 +41,7 @@
'EVENT_DISPLAY_FORMATTED' => EVENT_TYPE_CHAIN,
'EVENT_DISPLAY_RSS' => EVENT_TYPE_CHAIN,
'EVENT_DISPLAY_EMAIL' => EVENT_TYPE_CHAIN,
'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT' => EVENT_TYPE_CHAIN,

# Menu Events
'EVENT_MENU_MAIN' => EVENT_TYPE_DEFAULT,
Expand Down

0 comments on commit b292ef1

Please sign in to comment.