Browse Source

Added option to name custom email templates.

causefx 8 years ago
parent
commit
1aebce700d
3 changed files with 24 additions and 13 deletions
  1. 4 0
      config/configDefaults.php
  2. 8 1
      functions.php
  3. 12 12
      settings.php

+ 4 - 0
config/configDefaults.php

@@ -165,11 +165,15 @@ return array(
 	',
 	'emailTemplateRegisterUserSubject' => 'Thank you For Registering',
 	'emailTemplateCustomOne' => '',
+	'emailTemplateCustomOneName' => 'Template #1',
 	'emailTemplateCustomOneSubject' => '',
 	'emailTemplateCustomTwo' => '',
+	'emailTemplateCustomTwoName' => 'Template #2',
 	'emailTemplateCustomTwoSubject' => '',
 	'emailTemplateCustomThree' => '',
+	'emailTemplateCustomThreeName' => 'Template #3',
 	'emailTemplateCustomThreeSubject' => '',
 	'emailTemplateCustomFour' => '',
+	'emailTemplateCustomFourName' => 'Template #4',
 	'emailTemplateCustomFourSubject' => '',
 );

+ 8 - 1
functions.php

@@ -5710,10 +5710,16 @@ function buildAccordion($items){
 	$variables = '  Available Variables: ';
 	$accordion = '<div style="margin-bottom: 0px;" class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">';
 	foreach ($items as $key => $value) {
-		if($value['type'] == 'template'){
+		if($value['type'] == 'template' || $value['type'] == 'templateCustom'){
 			foreach ($value['variables'] as $variable) {
 				$variables .= '<mark>'.$variable.'</mark>';
 			}
+			$templateCustom = '
+			<div class="form-content col-sm-12 col-md-12 col-lg-12">
+				<input id="'.$value['template'].'Name_id" name="'.$value['template'].'Name" type="text" class="form-control material input-sm" autocorrect="off" autocapitalize="off" value="'.$value['title'].'">
+				<p class="help-text">Custom Template Name</p>
+			</div>
+			';
 			$accordion .= '
 			<div class="panel panel-default">
 				<div class="panel-heading" role="tab" id="heading-'.$i.'">
@@ -5721,6 +5727,7 @@ function buildAccordion($items){
 				</div>
 				<div id="collapse-'.$i.'" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-'.$i.'" aria-expanded="true">
 					<br/>'.$variables.'<br/></br/>
+					'.$templateCustom.'
 					<div class="form-content col-sm-12 col-md-12 col-lg-12">
 						<input id="'.$value['template'].'Subject_id" name="'.$value['template'].'Subject" type="text" class="form-control material input-sm" autocorrect="off" autocapitalize="off" value="'.$value['subject'].'">
 						<p class="help-text">Email Subject</p>

+ 12 - 12
settings.php

@@ -1769,32 +1769,32 @@ $emailTemplates = array(
         'template' => 'emailTemplateInviteUser',
 	),
 	array(
-		'type' => 'template',
-		'title' => 'Custom Email Template #1',
+		'type' => 'templateCustom',
+		'title' => emailTemplateCustomOneName,
         'variables' => array('{domain}','{fullDomain}'),
         'subject' => emailTemplateCustomOneSubject,
 		'body' => emailTemplateCustomOne,
         'template' => 'emailTemplateCustomOne',
 	),
 	array(
-		'type' => 'template',
-		'title' => 'Custom Email Template #2',
+		'type' => 'templateCustom',
+		'title' => emailTemplateCustomTwoName,
         'variables' => array('{domain}','{fullDomain}'),
         'subject' => emailTemplateCustomTwoSubject,
 		'body' => emailTemplateCustomTwo,
         'template' => 'emailTemplateCustomTwo',
 	),
 	array(
-		'type' => 'template',
-		'title' => 'Custom Email Template #3',
+		'type' => 'templateCustom',
+		'title' => emailTemplateCustomThreeName,
         'variables' => array('{domain}','{fullDomain}'),
         'subject' => emailTemplateCustomThreeSubject,
 		'body' => emailTemplateCustomThree,
         'template' => 'emailTemplateCustomThree',
 	),
 	array(
-		'type' => 'template',
-		'title' => 'Custom Email Template #4',
+		'type' => 'templateCustom',
+		'title' => emailTemplateCustomFourName,
         'variables' => array('{domain}','{fullDomain}'),
         'subject' => emailTemplateCustomFourSubject,
 		'body' => emailTemplateCustomFour,
@@ -2407,10 +2407,10 @@ echo buildSettings(
 												<button id="emailCustom" type="button" class="btn waves btn-labeled btn-dark btn-sm text-uppercase waves-effect waves-float dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="btn-label"><i class="fa fa-envelope"></i></span><span class="btn-text">Custom Email Templates</span></button>
 												<ul class="dropdown-menu">
 													<li class="dropdown-header">Choose a Template Below</li>
-													<li><a onclick="customEmail('one');" href="#">Template #1</a></li>
-													<li><a onclick="customEmail('two');" href="#">Template #2</a></li>
-													<li><a onclick="customEmail('three');" href="#">Template #3</a></li>
-													<li><a onclick="customEmail('four');" href="#">Template #4</a></li>
+													<li><a onclick="customEmail('one');" href="#"><?php echo emailTemplateCustomOneName; ?></a></li>
+													<li><a onclick="customEmail('two');" href="#"><?php echo emailTemplateCustomTwoName; ?></a></li>
+													<li><a onclick="customEmail('three');" href="#"><?php echo emailTemplateCustomThreeName; ?></a></li>
+													<li><a onclick="customEmail('four');" href="#"><?php echo emailTemplateCustomFourName; ?></a></li>
 												</ul>
 											</div>
                                         </div>