×
If you expect answers you should describe your problem and give as much information's as possible. (SQL-Structure, Template Code, Joomla Version ...) Please read this before posting: joodb.feenders.de/support.html
Editing controller.php to change the email data?
- ljackson1984
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
12 years 3 weeks ago - 12 years 1 week ago #1757
by ljackson1984
Editing controller.php to change the email data? was created by ljackson1984
Hi All,
I wonder if someone could kindly help me,
I have a form using JooDatabase which sends me an email when someone submits it, I am trying to change the email subject and title
so i have looked in the controller.php file and have found the part that needs changing
what i want to acheive is change the subject so that it includes the gym_discipline field text that the user submitted, but im not sure how to grab that particular form fields submitted data?
can anyone help
Thanks
Luke
I wonder if someone could kindly help me,
I have a form using JooDatabase which sends me an email when someone submits it, I am trying to change the email subject and title
so i have looked in the controller.php file and have found the part that needs changing
// send formdata to admin
if ($params->get("infomail",0)==1) {
$db->setQuery("SELECT email FROM `#__users` WHERE `id` ='".$params->get("infomail_user")."' LIMIT 1");
if ($email = $db->loadResult()) {
$MailFrom = $application->getCfg('mailfrom');
$FromName = $application->getCfg('fromname');
$subject = "JooDatabase - ".JText::_('New Database entry')." - ".$joodb->name;
$body = $subject."\r\n";
$body .= "Site: ".$application->getCfg('sitename')." - ".JUri::Current()."\r\n\r\n";
$body .= JText::_('Recieved values')."\r\n===================\r\n";
foreach ($item as $var=>$val) {
$body .= ucfirst($var).": ".$val."\r\n";;
}
$body .= "===================\r\n".JText::_('Statusmessage').": ".$msg."\r\n\r\n";
$mail = JFactory::getMailer();
$mail->addRecipient( $email );
$mail->setSender( array( $MailFrom, $FromName ) );
$mail->setSubject( $FromName.': '.$subject );
$mail->setBody( $body );
$sent = $mail->Send();
}
}
what i want to acheive is change the subject so that it includes the gym_discipline field text that the user submitted, but im not sure how to grab that particular form fields submitted data?
can anyone help
Thanks
Luke
Last edit: 12 years 1 week ago by joest.
Please Log in to join the conversation.
- Dirk
-
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
12 years 3 weeks ago #1760
by Dirk
Look here
The received values are in the $item array
Be aware that all changes in the controller.php will be lost after the next update!
Replied by Dirk on topic Re: Editing controller.php to change the email data?
ljackson1984 wrote: what i want to acheive is change the subject so that it includes the gym_discipline field text that the user submitted, but im not sure how to grab that particular form fields submitted data.
Look here
$subject = "JooDatabase - ".JText::_('New Database entry')." - ".$joodb->name;
The received values are in the $item array
$subject = "JooDatabase - ".JText::_('New Database entry')." - ".$item->['gym_discipline'];
Be aware that all changes in the controller.php will be lost after the next update!
Please Log in to join the conversation.
- ljackson1984
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
12 years 3 weeks ago #1768
by ljackson1984
Replied by ljackson1984 on topic Re: Editing controller.php to change the email data?
Hi Dirk,
Thanks for your reply,
I'm having trouble pulling out the required data, and i think its because $item is not declaired until further in the script, so this line
is breaking the script as there is no $item until 3 lines later
at least thats what i think is happening? what ever it is that first line ($subject) is killing the script
any ideas please
Thanks
Luke
Thanks for your reply,
I'm having trouble pulling out the required data, and i think its because $item is not declaired until further in the script, so this line
$subject = "JooDatabase - ".JText::_('New Database entry')." - ".$item->['gym_discipline'];
is breaking the script as there is no $item until 3 lines later
$subject = "JooDatabase - ".JText::_('New Database entry')." - ".$item->['gym_discipline'];
$body = $subject."\r\n";
$body .= "Site: ".$application->getCfg('sitename')." - ".JUri::Current()."\r\n\r\n";
$body .= JText::_('Recieved values')."\r\n===================\r\n";
foreach ($item as $var=>$val) {
$body .= ucfirst($var).": ".$val."\r\n";;
}
at least thats what i think is happening? what ever it is that first line ($subject) is killing the script
any ideas please
Thanks
Luke
Please Log in to join the conversation.
- ljackson1984
- Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
12 years 3 weeks ago #1778
by ljackson1984
Replied by ljackson1984 on topic Re: Editing controller.php to change the email data?
ok tried it again and its now working :) not sure what i did wrong first time lol
is there any way to prevent the controller.php file from being overwritten following an update?
many thanks for your help
Luke
is there any way to prevent the controller.php file from being overwritten following an update?
many thanks for your help
Luke
Please Log in to join the conversation.
Moderators: Dirk, joest