Thứ Bảy, 30 tháng 11, 2013

Joomla 1.5 - k2 comment notify email to admin

K2 component joomla 1.5 không hỗ trợ việc gửi mail báo cho admin khi có comment mới.
Vì vậy cần viết thêm đoạn code này.
File location cần hiệu chỉnh: components\com_k2\models\item.php
Sử dụng thư viện Utilities của joomla: thêm vào đoạn: jimport('joomla.utilities.utility');
Tìm chức năng: function comment()
Thêm đoạn : có thể thêm ở dòng 753 (trong function comment)
//sendmail            $linkitemcomment=JURI::base().$item->link=urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.$item->alias,
            $item->catid.':'.urlencode($item->category->alias))));                   
            $emailadmin=$mainframe->getCfg('mailfrom');
            $bodymail='Nội dung bình luận:'.$commentText.'<br/><a href="'.$linkitemcomment.'">'.$linkitemcomment.'</a>';
           
            JUtility::sendMail($commentEmail, $userName, $emailadmin, 'Có bình luận mới',$bodymail,1);


0 nhận xét:

Đăng nhận xét