Thanks to hernol and kuber for the code...
Step 1
ADD "DEFAULT SUBJECT" AS AN OPTION IN THE CONFIGURE MENU:
Open defaultconfig.inc and after this
- Code: Select all
"message_from_name" => array("Webmaster",
"What name do system messages appear to come from","text"),
Add this
# what is the default subject for messages without or with a space
"default_subject" => array($D_website." Newsletter",
"What is the default subject","text"),
Step 2
MAKE THE "DEFAULT SUBJECT" APPEAR ON SUBJECT LINE OF EDITOR WHEN YOU CLICK 'Send Message':
Open send_core.php and look for this
- Code: Select all
if (!$id) {
$defaulttemplate = getConfig('defaultmessagetemplate');
Sql_Query(sprintf('insert into %s (subject,status,entered,sendformat,embargo,repeatuntil,owner,template,tofield,replyto)
values("(no subject)","draft",now(),"text and HTML",now(),now(),%d,%d,"","")',$GLOBALS["tables"]["message"],$_SESSION["logindetails"]["id"],$defaulttemplate));
Change it to this
- Code: Select all
if (!$id) {
$defaulttemplate = getConfig('defaultmessagetemplate');
$default_subject = "'".getConfig('default_subject')."'";
Sql_Query(sprintf('insert into %s (subject,status,entered,sendformat,embargo,repeatuntil,owner,template,tofield,replyto)
values(%s,"draft",now(),"text and HTML",now(),now(),%d,%d,"","")',$GLOBALS["tables"]["message"],$default_subject,$_SESSION["logindetails"]["id"],$defaulttemplate));
Note that there are three changes to the above code:
(i) Added the line $default_subject = "'".getConfig('default_subject')."'";
(ii) Changed "(no subject)" to %s
(iii) inserted $default_subject, just before $_SESSION
Step 3 ***Note that this step is optional. You do not need to implement this 3rd step, if you don't like this feature***
AUTOMATICALLY INSERT "DEFAULT SUBJECT" INTO NEWSLETTER IF THE SUBJECT IS BLANK or SUBJECT IS (no subject):
Open sendemaillib.php and after this
- Code: Select all
$cached[$messageid]["fromname"] = trim($cached[$messageid]["fromname"]);
$cached[$messageid]["to"] = $message["tofield"];
Add this
- Code: Select all
$default_subject = getConfig("default_subject");
if ($message["subject"] == "" || $message["subject"] == "(no subject)"){
$message["subject"] = $default_subject;
$cached[$messageid]["subject"] = $default_subject;
}
else {
$cached[$messageid]["subject"] = $message["subject"];
}