Setting up 'Admin Email Notifications'

revive 16 Oct, 2008
Hello,

I am trying to setup the Admin Email in ChronoComments that lets the admin know a new comment has been posted..

What I am trying to do is include the name, email and comment text in the email...

Here is the code I used (similar to the verification email a user would get):
Hello, A new Comment has been submitted by {name} ( {email} ) at {sitename} , check it at this link :
{br}{br}
{commentlink}
{br}
{br}
{text}




But, this is the email I get:
Hello, A new Comment has been submitted by {name} ( {email} ) at The -------- edited out --------------- Center, check it at this link : 
http://www.----------------------------.com/index.php?option=com_content&id=134&view=article#commentID8 
{text}


Obviously, {text}, {name} and {email} are not valid codes for the admin email notices.. only the verification email.. any thoughts on how to make this work??

Basically, I need a way for the admin to be able to view the comment text and who it's from,.. without having to go to the site...

Thanks!
Max_admin 16 Oct, 2008
Hi Jesse,

each email has its own valid parameters, check the tooltip for available parameters per each!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
revive 17 Oct, 2008
Hey Thanks Max,..

How can I add additional parameters to the Admin Notification email.. the tooltip says that the only valid parameters are:
{sitename} , {commentlink} and {br}

I need to be able to add:
{name} , {email} and {text}
Max_admin 17 Oct, 2008
Hi, you need to hack components/com_chronocomments/chronocomments.php

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
revive 17 Oct, 2008
Thanks for pointing me in the right direction,.. that was quick and painless.. and looks great!

Thanks again!

Jesse
revive 06 Nov, 2008
For anyone else that might need this functionality (the ability to have the name, email, comment text, site name the comment was posted on and a link to that comment, within an Admin Notification Email) this code is for you:

Open your <site>/components/com_chronocomments/chronocomments.php and navigate to about line 184 (should say '//send admin notification email' above the code).
paste this code over that code block, to just above where is says '//Log Comment'.. make sure to make a backup in case of errors or the need to return to stock.


// send admin notification email
		// -----------------added name, email and text fields to admin template to provide better email of comments to admin
		if((!$post['commentid'])&&($configs->get('admin_notify') == '1')){
			$email_elements = array(
				'{br}' => '<br>', 
				'{name}' => $post['name'],
				'{text}' => $post['text'],
				'{email}' => $post['email'], 
				'{sitename}' => $mainframe->getCfg('sitename'), 
				'{commentlink}' => JRoute::_(JURI::Base().'index.php?option='.$row->component.'&id='.$row->pageid.'&view=article#commentID'.$row->id)
			);
			$email_body = $configs->get('nemail_body');
			foreach($email_elements as $email_element_name => $email_element_value){			
				$email_body = str_replace($email_element_name, $email_element_value, $email_body);
			}
			$subject = str_replace("{sitename}", $mainframe->getCfg('sitename'), $configs->get('nemail_subject'));
			JUtility::sendMail($configs->get('nemail_fromemail'), $configs->get('nemail_fromname'), $configs->get('nemail_to'), $subject, $email_body, true, NULL, NULL, NULL, NULL, NULL );
		}
This topic is locked and no more replies can be posted.