By PAlridR on Tuesday, 29 November 2016
Replies 3
Likes 0
Views 3.7K
Votes 0
Hi there !

I want to share a little trick to map discussions categories with articles categories and I hope to find this in a future version.

My idea is simple, just put the same alias in content categories AND easydiscuss categories to map them.

File : plugins/content/easydiscuss/easydiscuss.php

Change line 618


$data['category_id'] = $params->get('category_storage', 1);


To,


// Map discussion category with article category if alias are the same
$db = JFactory::getDbo();
$db->setQuery("SELECT b.id FROM #__categories AS a LEFT JOIN #__discuss_category AS b ON a.alias = b.alias WHERE b.alias = '" . $article->category_alias . "'");
$row = $db->loadRow();
if( !empty($row) ) {
$data['category_id'] = $row[0];
} else {
$data['category_id'] = $params->get('category_storage', 1);
}


Enjoy
Nice, thanks for sharing I have also helped you to edit your post so that the codes are in the code block.
·
Tuesday, 29 November 2016 22:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes thanks I saw that.

To avoid change source file in future, can you confirm it will be include in next version ?
·
Tuesday, 29 November 2016 23:03
·
0 Likes
·
0 Votes
·
0 Comments
·
We are really appreciated with your opinion and effort, I will discuss with our team and consider implement this in the future version.
·
Wednesday, 30 November 2016 13:03
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post