Под настроение, решил поделиться

У меня работает на JomSocial 1.6.288
Итак, для автоматического оповещения о сообщениях надо:
1. В файл /components/com_community/controllers/notification.php после строк
class CommunityNotificationController extends CommunityBaseController
{
добавить следующий код
function ajaxNotifyUser()
{
if (!isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$objResponse = new JAXResponse ();
$my = CFactory::getUser();
$inboxModel =& CFactory::getModel( 'inbox' );
$friendModel =& CFactory::getModel ( 'friends' );
$unreadInbox = $inboxModel->getUnReadInbox();
$pendingFren = $friendModel->getPending($my->id);
$msgCount = 0;
if(! empty( $unreadInbox ))
{
$msgCount += count($unreadInbox);
}
if(! empty( $pendingFren ))
{
$msgCount += count($pendingFren);
}
if ($msgCount > 0)
{
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify-count").text('. $msgCount . ');');
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify").show();');
}
return $objResponse->sendResponse();
}
2. В файл /components/com_community/jax.community.php после строки
(что, конечно же, для удобства) добавить
$jaxFuncNames[]= 'notification,ajaxNotifyUser';
3. В папке /components/com_community/assets/ создать файл automsg.js
function AutoMsg() {
if ((jQuery('#cWindow').length < 1) || (jQuery('#cWindow').css('display') == 'none')) {
jax.call("community", "notification,ajaxNotifyUser");
}
setTimeout("AutoMsg()", 10000);
}
jQuery(document).ready(function() {
AutoMsg();
});
4. В шаблоне (я вставил в шаблон Joomla сразу перед
) добавляем вызов скрипта
<script type="text/javascript" src="/components/com_community/assets/automsg.js"></script>
5. В шаблоне в файле toolbar.index.php заменяем
<?php if ( (!empty($notiAlert)) && ($notiAlert > 0) ) { ?>
<li id="toolbar-item-notify">
<a href="javascript:joms.notifications.showWindow();">
<span id="toolbar-item-notify-count"><?php echo $notiAlert; ?></span>
</a>
</li>
<?php }//end if?>
на
<?php //if ( (!empty($notiAlert)) && ($notiAlert > 0) ) { ?>
<li id="toolbar-item-notify" class="toolbar-item" style="display: none;">
<a href="javascript:joms.notifications.showWindow();">
<span id="toolbar-item-notify-count"><?php //echo $notiAlert; ?></span>
</a>
</li>
<?php //}//end if?>
Пользуйтесь! Буду рад, если кому пригодится

Да, и еще, могу модифицировать под нужды, но уже за $$, точнее рубли
Да и еще, всплывающих окошек не будет. Просто должен появиться блок количеством новых сообщений. Если нужно всплывающее окошко, то в модуле notification.php в функции ajaxNotifyUser код
if ($msgCount > 0)
{
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify-count").text('. $msgCount . ');');
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify").show();');
}
надо заменить на
if ($msgCount > 0)
{
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify-count").text('. $msgCount . ');');
$objResponse->addScriptCall( 'jQuery("#toolbar-item-notify").show();');
$objResponse->addScriptCall( 'joms.notifications.showWindow();');
}
Вроде все
