Keyword

how do u enable notifcations of comments

More
12 years 5 months ago #64202 by rawling
Replied by rawling on topic Re: how do u enable notifcations of comments
I have skype, but i not speak by english.
Better write my by email - This email address is being protected from spambots. You need JavaScript enabled to view it.

About my previous post: this code work on my real site and localhost (denwer) with php mail function.
This code of mail notification was taken and adapte from free old plugin k2_autoarchiver: getk2.org/community/New-to-K2-Ask-here-first%21/10843-k2-autoarchiver-plugin

Instead gmail can use other mail servers that forward mail to SMTP protocol. This is better than use php mail function (for example for Acymailing), the SMTP certifcate of mail server (in this case gmail) better of certificate of your hosting, ensure that the mails does not put into spam.

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #64203 by anoush
thanks, works with k2 2.5.1 joomla 2.5.2 and local mta
i didn't understand since in comment preference there's email field for report

Please Log in or Create an account to join the conversation.

More
12 years 4 months ago #64204 by rawling
Replied by rawling on topic Re: how do u enable notifcations of comments
New added:

1) IP address
2) URL of K2 item with komment
$mailer =& JFactory::getMailer();
			$config =& JFactory::getConfig();
			$sender = array(
			$config->getValue( 'config.mailfrom' ),
			$config->getValue( 'config.fromname' ) );
			$mailer->setSender($sender);
 			$recipient = explode(",", "[email protected], [email protected]");
			$mailer->addRecipient($recipient);
			$mailer->setSubject(JText::_('K2_NEWCOMMENT_EMAIL'));
			$userIP = $_SERVER['REMOTE_ADDR'];
			$baselink = '<a href="'. JURI::base();
			$link = K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid.':'.urlencode($item->category->alias)). '">Comment Link</a>';
			if  (!trim($commentURL)=="") {
				  $commentURL = "Site: ". $commentURL. "<br>";
			}
			$body = 'Name: '. $userName.  '<br/>'. 'E-mail: '. $commentEmail. '<br/>'. $commentURL. 'Comment: '. $commentText. '<br/>'. 'IP: '.$userIP. '<br/>'. 'Comment Link: '.$baselink. $link;
 			$mailer->setBody($body);
			$mailer->isHTML(true);
			$mailer->Send();

		}

 		$mainframe->close();
	}

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #64205 by Paul Boutin
Replied by Paul Boutin on topic Re: how do u enable notifcations of comments
YOU ROCK RAWLING :woohoo: :woohoo: :woohoo: :woohoo: :woohoo:

Please Log in or Create an account to join the conversation.

More
12 years 4 weeks ago #64206 by robm
Wonderfull thanks!

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #64207 by Tim Lord
Replied by Tim Lord on topic Re: how do u enable notifcations of comments
Hi there,

I've just tried to implement this now on a client site but adding the code to the configuration.php breaks the whole site before I can go any further.

I am trying it on a Joomla 3 site running K2 2.6.6 and it looks like the code is a bit different in the K2 php files as well.

Do you think this could work on Joomla 3 and on the latest version of K2 and if so could you offer any advice on the same please? I really need to get this implemented and it is driving me crazy!

Many thanks in advance

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum