View Issue Details

IDProjectCategoryView StatusLast Update
0015648mantisbtemailpublic2025-01-23 06:44
ReporterHeikoSL Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.14 
Target Version1.2.16Fixed in Version1.2.16 
Summary0015648: add event signalling to email_build_subject() function
Description

For customization I need to add event signalling to email_build_subject() function. That will let me use a plugin to customize email subjects.

Additional Information

depends on 0015647 to work properly on all email subjects
related to 0008986

TagsNo tags attached.
Attached Files
hook_build_subject.patch (1,445 bytes)   
From 0eff23778d515e7b9b7ede523e865aa279474079 Mon Sep 17 00:00:00 2001
From: Heiko Schneider-Lange <heikoschneider@web.de>
Date: Wed, 13 Mar 2013 12:19:09 +0100
Subject: [PATCH] add hook EVENT_DISPLAY_EMAIL_BUILD_SUBJECT for email subject

---
 core/email_api.php  |    7 ++++++-
 core/events_inc.php |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/core/email_api.php b/core/email_api.php
index 0c3ac15..154f947 100644
--- a/core/email_api.php
+++ b/core/email_api.php
@@ -1087,7 +1087,12 @@ function email_build_subject( $p_bug_id ) {
 	# padd the bug id with zeros
 	$p_bug_id = bug_format_id( $p_bug_id );
 
-	return '[' . $p_project_name . ' ' . $p_bug_id . ']: ' . $p_subject;
+	$t_email_subject = '[' . $p_project_name . ' ' . $p_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;
 }
 
 /**
diff --git a/core/events_inc.php b/core/events_inc.php
index 5079aa4..1c24d9a 100644
--- a/core/events_inc.php
+++ b/core/events_inc.php
@@ -41,6 +41,7 @@ event_declare_many( array(
 	'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,
-- 
1.7.2.5

hook_build_subject.patch (1,445 bytes)   

Relationships

related to 0008986 new customized eMail subjects 
parent of 0015647 closedatrol email subject is build manually in function email_bug_info_to_one_user() 
related to 0035255 closeddregad Unknown named parameter $bug_id 

Activities

HeikoSL

HeikoSL

2013-03-13 11:04

reporter   ~0035855

https://github.com/mantisbt/mantisbt/pull/77

HeikoSL

HeikoSL

2013-03-15 05:28

reporter   ~0035872

for whom it may concern:
the plugin that depends on this entry can be found in https://github.com/langerheiko/CustomizeEmailSubject_for_MantisBT

dregad

dregad

2013-04-20 12:40

developer   ~0036634

Forked in mantibt-plugins organization - https://github.com/mantisbt-plugins/CustomizeEmailSubject

Related Changesets

MantisBT: master-1.2.x 4090050b

2013-04-19 07:56

dregad


Details Diff
Add plugin event for e-mail subject customization

New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT

Fixes 0015648
Affected Issues
0015648
mod - core/email_api.php Diff File
mod - core/events_inc.php Diff File

MantisBT: master b292ef1b

2013-04-19 07:56

dregad


Details Diff
Add plugin event for e-mail subject customization

New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT

Fixes 0015648
Affected Issues
0015648, 0035255
mod - core/email_api.php Diff File
mod - core/events_inc.php Diff File