Given up on Codoforum :(
Maybe after each topic we could show 3-5 related topics...this would increase stickiness of forum and user engagement. A bit like Wordpress's related posts plugin.
Given up on Codoforum :(
We have a plugin for this here:
https://github.com/evnix/codo_similar_topics
@adesh1414127033 on install
got this
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<> 69 AND p.post_id = t.post_id AND EXISTS (SELECT 1 FROM codo_permissions AS p' at line 1' in /home/sites/#####.co.uk/public_html/sys/CODOF/Search/Search.php:191 Stack trace: #0 /home/sites/######.co.uk/public_html/sys/CODOF/Search/Search.php(191): PDO->prepare('SELECT p.post_...') #1 /home/sites/#####.co.uk/public_html/sites/default/plugins/codo_similar_topics/codo_similar_topics.php(55): CODOF\Search\Search->search() #2 [internal function]: plg_similar_topics->get_similar_topics(Array, Array) #3 /home/sites/####.co.uk/public_html/sys/CODOF/Hook.php(65): call_user_func_array(Array, Array) #4 /home/sites/#####.co.uk/public_html/sys/Controller/forum.php(431): CODOF\Hook::call('on_topic_view', Array) #5 /home/ in /home/sites/####.co.uk/public_html/sys/CODOF/Search/Search.php on line 191
Given up on Codoforum :(
Make this change
Open sites/default/plugins/codo_similar_topics/codo_similar_topics.php
On line 52,
replace
$search->tid = '<> ' . $info[0]['topic_id'];
with
$search->tid = '!= ' . $info[0]['topic_id'];
Ah ok @admin and I see oh my gosh: Codoforum 4.0!
@admin thanks for updating plugin at GitHub
Given up on Codoforum :(
@admin is there a way to change the sensitivity of the "relatedness" as at moment the topics the plugin is showing don't look related enough...
Given up on Codoforum :(
Hi @adesh1414127033 , @hard_as_snails , @RolluS
I download the plugin from https://github.com/evnix/codo_similar_topics. However, after installing the plugin as the guildeline, I can see anything in the side bar. I'm using codo 3.3.1.
I add some commnet into the codo_similar_topics.php
for tracking. Should I edit any other things?
<?php
/*
* @CODOLICENSE
*/
...
echo "Begin test codo similar topic.";
echo "<br />";
defined('IN_CODOF') or die();
class plg_similar_topics{
function get_similar_topics($info){
require 'common_words.php';
$common_words = plg_get_common_words();
$search = new \CODOF\Search\Search();
$title=$info[0]['title'];
//replace double spaces with single space
$title = str_replace(" ", " ",$title);
//get all the words in an array
$words=explode(" ",$title);
//remove the common words
$tarray= array_diff($words, $common_words);
//join the new array
$title=implode(" OR ", $tarray);
$search->str=$title;
$search->tid = '!= ' . $info[0]['topic_id'];
$search->pid = '= t.post_id';
$links=$this->generate_links($search->search());
$asset = new \CODOF\Asset\Stream();
$col = new \CODOF\Asset\Collection('head_col');
$col->addCSS(PLUGIN_DIR . "similar_topics/view.less");
$asset->addCollection($col);
//args: plugin_name,view_file,data
Block::renderView('codo_similar_topics','view.tpl',['topics'=>$links]);
}
function generate_links($topics){
$links=[];
foreach($topics as $topic){
$links[]=['link'=>\CODOF\Forum\Forum::getPostURL($topic['topic_id'],$topic['title']),
'title'=>$topic['title']];
}
return $links;
}
}
Hook::add('on_topic_view',[ new plg_similar_topics,'get_similar_topics']);
echo "End test codo similar topic.";
Can't see any similar posts, except my comments.
I'm using codo 3.3.1.
The current version is 3.5, it's time for an update.
@James7 Probably better for him to wait until the bugs in 3.5 have been sorted first. There have been a couple that would cause issues atm. I have stayed with 3.4 myself atm until the bugs are fixed or 3.5.1 with the bugs fixed is released (preferably).
Thank you @James7 and @RonAus !
It works on the 3.4 B19 beta verion. I'm waiting for 3.5.x official release.
Your previous draft for topic is pending
If you continue, your previous draft will be discarded.