Используемые версии:
PHP: 5.2.0 Joomla 1.5.14 My Blog 3.0 Build 329 JComments 2.1.0.0
После установки JComments , естественно никакой автоматической интеграции в My Blog не получилось, т.к. они не предназначены друг для друга. Изначально My Blog заточен под JomComment .
1. В файле /components/com_myblog/task/show.php меняем код:
Код PHP jimport( 'joomla.filesystem.file' ) ;
$file = JPATH_PLUGINS . DS . 'content' . DS . 'jom_comment_bot.php' ;
if ( JFile:: exists ( $file ) )
{
require_once ( $file ) ;
// Check if admin allows user to enable or disable the comment on the blog
if ( $_MY_CONFIG -> get ( 'enableJCDashboard' ) )
{
if ( eregi ( '' , $row -> text ) )
{
$row -> text = str_replace ( '' , '' , $row -> text ) ;
}
else if ( eregi ( '' , $row -> text ) )
{
$row -> text = str_replace ( '' , '' , $row -> text ) ;
$row -> comments = "" ;
$row -> comments = jomcomment( $row -> id , "com_myblog" ) ;
}
else if ( eregi ( '{jomcomment lock}' , $row -> text ) )
{
$row -> text = str_replace ( '{jomcomment lock}' , '' , $row -> text ) ;
$row -> comments = "" ;
$row -> comments = jomcomment( $row -> id , "com_myblog" , '' , '' , true ) ;
}
else
{
// Default
// User is not allowed to enable or disable comments
// so we use the default value to display
$row -> comments = "" ;
$row -> comments = jomcomment( $row -> id , "com_myblog" ) ;
}
}
else
{
// User is not allowed to enable or disable comments
// so we use the default value to display
$row -> comments = "" ;
$row -> comments = jomcomment( $row -> id , "com_myblog" ) ;
}
}
на следующий код:
Код PHP
global $mainframe ;
$comments = JRoute:: _( 'components/com_jcomments/jcomments.php' ) ;
if ( file_exists ( $comments ) ) {
require_once ( $comments ) ;
$language = & JFactory:: getLanguage ( ) ;
$language -> load ( 'com_jcomments' , JPATH_SITE) ;
$row -> comments = JComments:: showComments ( $row -> id , 'com_myblog' , $row -> title ) ;
}
2. Далее в файле /components/com_myblog/functions.myblog.php меняем код:
Код PHP /**
* Retrieve number of comments for a given user
*/
function myCountUserComment1( $uid )
{
global $_MY_CONFIG ;
$sections = $_MY_CONFIG -> get ( 'managedSections' ) ;
$db =& JFactory:: getDBO ( ) ;
$strSQL = "SELECT COUNT(*) FROM #__jomcomment AS a "
. "INNER JOIN #__content AS b "
. "WHERE b.id=a.contentid "
. "AND a.option='com_myblog' "
. "AND b.created_by='{$uid} '" ;
$db -> setQuery ( $strSQL ) ;
$result = $db -> loadResult ( ) ;
if ( $result == "" )
return 0 ;
return $result ;
} на следующий код:
Код PHP /**
* Retrieve number of comments for a given user
*/
function myCountUserComment( $uid ) {
global $mainframe ;
$comments = JRoute:: _( 'components/com_jcomments/jcomments.php' ) ;
if ( file_exists ( $comments ) ) {
require_once ( $comments ) ;
$result = JComments:: getCommentsCount ( $uid , 'com_myblog' , "\n AND userid = " . $uid ) ;
}
if ( $result == "" )
return 0 ;
return ( int) $result ;
} 3. Далее чуть ниже меняем код:
Код PHP function myCommentsURLGet( $contentid , $addCommentCount = true , $task = "" )
{
global $Itemid , $MYBLOG_LANG ;
$link = "" ;
if ( $task != "" )
$task = "&task=$task " ;
if ( $addCommentCount )
{
$numcomment = intval ( myCountJomcomment( $contentid ) ) ;
}
return JText:: sprintf ( 'BLOG COMMENTS' , $numcomment ) ; //$link;
} на следующий код:
Код PHP function myCommentsURLGet( $contentid , $addCommentCount = true , $task = "" )
{
global $Itemid , $MYBLOG_LANG , $mainframe ;
$link = "" ;
if ( $task != "" )
$task = "&task=$task " ;
if ( $addCommentCount )
{
$comments = JRoute:: _( 'components/com_jcomments/jcomments.php' ) ;
if ( file_exists ( $comments ) ) {
require_once ( $comments ) ;
$numcomment = JComments:: getCommentsCount ( $contentid , 'com_myblog' ) ;
}
}
return JText:: sprintf ( 'BLOG COMMENTS' , $numcomment ) ; //$link;
} 4. Далее в файле /administrator/components/com_myblog/config.myblog.php меняем в двух местах:
Код PHP
`option`= 'com_jomcomment'
на:
Код PHP
`option`= 'com_jcomments'
5. Далее в файле /plugins/content/jcomments.php меняем код:
Код PHP function onPrepareContent( & $article , & $params , $limitstart )
{
require_once ( JCOMMENTS_HELPERS . DS . 'plugin.php' ) ;
require_once ( JCOMMENTS_HELPERS . DS . 'contentplugin.php' ) ;
require_once ( JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'language.tools.php' ) ;
// check whether plugin has been unpublished
if ( ! JPluginHelper:: isEnabled ( 'content' , 'jcomments' ) ) {
JCommentsContentPluginHelper:: clear ( $article , true ) ;
return ;
}
$application = & JFactory:: getApplication ( 'site' ) ;
$option = JRequest:: getCmd ( 'option' ) ;
$view = JRequest:: getCmd ( 'view' ) ;
if ( ! isset ( $article -> id ) || ( $option != 'com_content' && $option != 'com_alphacontent' ) ) {
return ;
} на следующий код:
Код PHP function onPrepareContent( & $article , & $params , $limitstart )
{
global $option , $_MY_CONFIG ;
require_once ( JCOMMENTS_HELPERS . DS . 'plugin.php' ) ;
require_once ( JCOMMENTS_HELPERS . DS . 'contentplugin.php' ) ;
require_once ( JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'language.tools.php' ) ;
// check whether plugin has been unpublished
if ( ! JPluginHelper:: isEnabled ( 'content' , 'jcomments' ) ) {
JCommentsContentPluginHelper:: clear ( $article , true ) ;
return ;
}
$application = & JFactory:: getApplication ( 'site' ) ;
//$option = JRequest::getCmd('option');
$view = JRequest:: getCmd ( 'view' ) ;
$show = JRequest:: getCmd ( 'show' ) ;
if ( ! isset ( $article -> id ) || ( $option != 'com_content' && $option != 'com_alphacontent' && $option != 'com_alphacontent' && $option != 'com_myblog' ) ) {
return ;
} 6. Далее чуть ниже меняем код:
Код PHP if ( $view != 'article' ) {
// show link to comments only
$count = JComments:: getCommentsCount ( $article -> id , 'com_content' ) ; на следующий код:
Код PHP if ( $view != 'article' && empty ( $show ) ) {
// show link to comments only
$count = JComments:: getCommentsCount ( $article -> id , 'com_content' ) ;
if ( $option == 'com_myblog' && $_MY_CONFIG -> get ( 'useComment' ) ) {
$count = JComments:: getCommentsCount ( $article -> id , 'com_myblog' ) ;
}
$user = & JFactory:: getUser ( ) ; 7. Далее чуть ниже меняем код:
Код PHP if ( $article -> access <= $user -> get ( 'aid' , 0) ) {
$readmore_link = JRoute:: _( ContentHelperRoute:: getArticleRoute ( $article -> slug , $article -> catslug , $article -> sectionid ) ) ;
$readmore_register = 0 ; на следующий код:
Код PHP if ( $article -> access <= $user -> get ( 'aid' , 0) ) {
if ( empty ( $view ) && empty ( $show ) ) {
$readmore_link = JRoute:: _( myGetPermalinkUrl( $article -> id ) ) ;
} else {
$readmore_link = JRoute:: _( ContentHelperRoute:: getArticleRoute ( $article -> slug , $article -> catslug , $article -> sectionid ) ) ;
}
$readmore_register = 0 ; 8. Далее чуть ниже меняем код:
Код PHP //links_position
if ( $this -> params -> get ( 'links_position' , 1) == 1) {
$article -> text .= $tmpl -> renderTemplate ( 'tpl_links' ) ;
} else {
$article -> text = $tmpl -> renderTemplate ( 'tpl_links' ) . $article -> text ;
}
$tmpl -> freeTemplate ( 'tpl_links' ) ;
if ( $this -> params -> get ( 'readmore_link' , 1 ) == 1 ) { на следующий код:
Код PHP //links_position
if ( $this -> params -> get ( 'links_position' , 1) == 1) {
if ( ( $option !== 'com_myblog' ) || ( $option == 'com_myblog' && $_MY_CONFIG -> get ( 'useComment' ) ) ) {
$article -> text .= $tmpl -> renderTemplate ( 'tpl_links' ) ;
}
} else {
$article -> text = $tmpl -> renderTemplate ( 'tpl_links' ) . $article -> text ;
}
$tmpl -> freeTemplate ( 'tpl_links' ) ;
if ( $this -> params -> get ( 'readmore_link' , 1) == 1 && $option != 'com_myblog' ) { 6. Заходим в настройки MyBlog -> Content Mambots Integration. Смотрим, если выключен Content - JComments , то включаем его.
Вот вобщем то и всё.
P.S. Если JComments заработал, и в статьях можно оставлять комментарии, а на главной MyBlog`а нет ссылки "Добавить комментарий", значит у вас не включены мамботы на главной. Где? Тут: "MyBlog - General Settings - Layout - Use mambots on My Blog frontpage". Ставим галочку и радуемся.
Скачать:
Файл Описание Размер файла Скачено
JComments&MyBlog Измененые файлы JComments&MyBlog 24 Kb 896
Комментарии
А ведь очень надо!
Исправил. Качайте!
нет. jomcomment не надо устанавливать.
Помогла эта статья!!!
А можно у автора попросить выложить русификацию для MyBlog (или на мыло кинуть) или ссылку дать,где скачать!! Руссификация для пользовательско й части - на сайт вобщем:)
Всегда пожалуйста.
Цитирую July07:
Возьми тут blog.bcmk.ru/myblog/lokalizatsiya-my-blog-3-0-build-329.html
Автору спасибо !
RSS