Change subject[SOLVED]

0
is possible to change the subject with a dropbox selected option?

-----------------------------------------SOLVED-------------------------------------------------------------
ADD line in two files:
*.\com_b2jcontact\helpers\b2jdispatcher.php
add:

[left]protected function setAsunto()
{
$asunto = "";
foreach ($this->FieldsBuilder->DynamicFields as $key => $field){
if($field[0]->state != 0){
foreach ($field[1] as $dynamicfield){
$asunto .= $this->cargarAsunto($dynamicfield);
}
}
}
return $asunto;
}

protected function cargarAsunto(&$field)
{
$asunto = "";
if ($field->b2jFieldState == 0) $asunto = "";
if ($field->b2jFieldName == "Asunto") $asunto = $field->b2jFieldValue;
return $asunto;
}
[/left]
*.\com_b2jcontact\helpers\b2jadminmailer.php
add:

public function Process()
{
$mail = JFactory::getMailer();

$this->set_from($mail);
$this->set_to($mail, "to_address", "addRecipient");
$this->set_to($mail, "cc_address", "addCC");
$this->set_to($mail, "bcc_address", "addBCC");

// Changed
//$mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_subject", "")));

// with this
$mail->setSubject($this->setAsunto());

$body = $this->body();
$body .= $this->attachments($mail);
$body .= PHP_EOL;

$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;

$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;

$body = JMailHelper::cleanBody($body);
$mail->setBody($body);

$this->Logger->Write("---------------------------------------------------" . PHP_EOL . $body);

return $this->send($mail);
}

I hope it helps someone
Responses (1)
Sorry, but you are not allowed to view the replies here.
Your Reply

Cron Job Starts