Топаем сюда - (AdminCP -> Settings -> Add New Setting)
(Этот мод будет доступен в AdminCP -> Settings -> System Settings -> Module Settings -> Feed)
Product: phpFox
Module: feed
Groups: Content Formatting
Variable: crop_comment_in_notification_email_to
Type: Integer
Value: 255
Title: Crop comment in notification e-mail to
Info:
This is the amount of characters of the original comment that will appear in the content of the notification e-mail.
2. Добавление фраз (AdminCP -> Extension -> Language -> Add Phrase):
Product: phpfox
Module: feed
Varname: full_name_left_a_comment_on_owner_name_feed_to_view_this_comment
Text:
PHP:
{full_name} left a comment on {owner_name}'s update.
{full_name} wrote:
<blockquote><em>{comment}</em></blockquote>
To view this comment, follow the link below:
<a href="{link}">{link}</a>
Product: phpfox
Module: feed
Varname: full_name_left_a_comment_on_owner_name_feed
Text:
PHP:
{full_name} left a comment on the {owner_name}'s update.
Product: phpfox
Module: user
Varname: someone_added_a_comment_on_owner_name_feed
Text:
PHP:
Another member has commented on one of the <a href="{owner_link}">{owner_name}'s</a> activity <a href="{link}">feed</a>, where you have commented too.
3. Открый файл /module/feed/include/service/callback.class.php. Ищем:
PHP:
public function addComment($aVals, $iUserId = null, $sUserName = null)
Добавить:
PHP:
// POSSIBLE SOLUTION BY FERN. This can be a plug-in (if the hook will exist someday) or be added in the next version.
// CAUTION, as it could generate a lot of e-mails.
// Get the comment from the database
$sComment = $this->database()->select('ct.text')
->from(Phpfox::getT('comment_text'), 'ct')
->where('ct.comment_id = '.$aVals['comment_id'])
->execute('getField');
// Get the comment text and crop it according to the feed setting
$sParsedComment = substr($sComment, 0, Phpfox::getParam('feed.crop_comment_in_notification_email_to'));
// Get the owner's full name and user id of those who have posted a comment in the specific feed
$aUsersToMail = $this->database()->select('u.full_name as owner_name, c.user_id')
->from(Phpfox::getT('comment'), 'c')
->join($this->_sTable, 'f', 'c.item_id = f.feed_id')
->join(Phpfox::getT('user'), 'u', 'u.user_id = f.user_id')
->where('c.item_id = '.$aFeed['feed_id'])
->group('c.user_id')
->execute('getSlaveRows');
foreach($aUsersToMail as $aUser)
{
// if the feed owner has posted a comment, there is no need to notify him twice.
if ($aFeed['user_id'] != $aUser['user_id'])
{
// Send the e-mail to the current user in the list of users that have commented in the feed.
Phpfox::getLib('mail')->to($aUser['user_id'])
->subject(array
('feed.full_name_left_a_comment_on_owner_name_feed', array(
'full_name' => $sUserName,
'owner_name' => $aUser['owner_name'],
'site_title' => Phpfox::getParam('core.site_title')
)
)
)
->message(array
('feed.full_name_left_a_comment_on_owner_name_feed_to_view_this_comment', array(
'full_name' => $sUserName,
'owner_name' => $aUser['owner_name'],
'comment' => $sParsedComment,
'site_title' => Phpfox::getParam('core.site_title'),
'link' => $sLink
)
)
)
->notification('comment.add_new_comment')
->send();
// Also, add a site notification to the current user in the list of users that have commented in the feed.
Phpfox::getService('notification.process')->add('comment_feed', $aFeed['feed_id'], $aUser['user_id'], $aFeed['user_id']);
}
}
// END OF FERN'S SOLUTION! END__PHPFOX__CODE__SNIPPET ?>
4. Ищем далее
PHP:
public function getCommentNotificationFeed($aRow)
Заменяем на :
PHP:
/ POSSIBLE SOLUTION BY FERN. This can be a plug-in (if the hook will exist someday) or be added in the next version.
if(empty($aRow['item_image']) && ($aRow['type_id'] == 'comment_feed') ) // != Phpfox::getUserBy('user_name'))
{
$aOwner = $this->database()->select('u.full_name, u.user_name')
->from(Phpfox::getT('user'), 'u')
->join(Phpfox::getT('feed'), 'f', 'u.user_id = f.user_id')
->where('f.feed_id = '. $aRow['item_id'])
->execute('getSlaveRow');
return array(
'message' => Phpfox::getPhrase('user.someone_added_a_comment_on_owner_name_feed', array(
'owner_name' => $aOwner['full_name'],
'owner_link' => Phpfox::getLib('url')->makeUrl($aOwner['user_name']),
'link' => Phpfox::getLib('url')->makeUrl($aOwner['user_name'], array('feed' => $aRow['item_id'])) . '#feed'
)
),
'link' => Phpfox::getLib('url')->makeUrl($aOwner['user_name'], array('feed' => $aRow['item_id'])) . '#feed',
'path' => 'core.url_user',
'suffix' => '_50'
);
}
else
{
return array(
'message' => Phpfox::getPhrase('user.user_link_full_name_commented_on_your_status', array(
'user_link' => Phpfox::getLib('url')->makeUrl($aRow['user_name']),
'full_name' => $aRow['full_name'],
'link' => Phpfox::getLib('url')->makeUrl('profile', array('feed' => $aRow['item_id'])) . '#feed'
)
),
'link' => Phpfox::getLib('url')->makeUrl('profile', array('feed' => $aRow['item_id'])) . '#feed',
'path' => 'core.url_user',
'suffix' => '_50'
);
}
// END END__PHPFOX__CODE__SNIPPET ?>
5. Сохраните и закройте файл.
Все. Пробуем. Отписываемся.
---------- Сообщение добавлено в 06:58 ---------- Предыдущее сообщение было в 06:44 ----------
Спёр это с забугорного форума.. Скрина нет. Что там должно быть не известно. Поставил у себя... Работает, но все тоже самое, обычные текстовые сообщения. Либо это просто добавление функции...