Hi, here is the first version of "related plugin", this shows posts related to current view. Before to put in plugins directory i wish to have some feedback.
Demo: http://ajayu.memi.umss.edu.bo/omegaman/weblog/generics-en-arreglos
Download here: http://elgg.org/mod/plugins/plugin.php?id=31
Elgg plugin relatedposts 0.0.2a
This plugin show related posts in the same and others blogs on
the current post and next/prev posts.
* Tested only with mysql.
To install:
1. Copy this directory to your elgg_dirroot/mod/
2. Login into your elgg installation as administrator (usually 'news').
3. Go to http://elgg_wwwroot/mod/relatedposts/dbsetup.php
4. You need to modify the file units/weblogs/weblogs_posts_view.php around
line 130 in order to show related posts block before comments.
On latest version, modify the file mod/blog/lib/weblogs_posts_view.php
around line 145
* Find the nex code:
if (isset($individual) && ($individual == 1)) {
// looking at an individual post and its comments
$commentsbody = "";
* And add two lines, see below:
if (isset($individual) && ($individual == 1)) {
// looking at an individual post and its comments
// Relatedpost plugin (i didn't find better place to put this)
$links .= run('mod:relatedposts:show', $post);
$commentsbody = "";
5. See working on any posts at your site.
--
Rolando Espinoza La Fuente <darkrho@gmail.com>

Comments
If you get to much fuzzy related posts, try comment the the next line on file relatedposts_show.php line 24:
// $terms = stripslashes($post->title);
Hi Rolando,
You are working on this with an old relase of elgg, right? units/weblogs doesn't exist anymore, it has been pushed to mod/blog with several modifications. Have you tried this with latest svn?
Cheers
Hi Renato,
i recently update my working copy, and updated info about installing on latest version. (see the post).
Any feedback would be appreciate.
I did this months ago with another query. I'm curious if the one used here is more efficient than mine (using tags/keywords instead of matching titles and content).
This is my query:
select p.ident as id,title,name,username from {$CFG->prefix}weblog_posts p left join {$CFG->prefix}users u on p.owner=u.ident where p.ident in (select ref from {$CFG->prefix}tags where tag in (select tag from {$CFG->prefix}tags where ref={$post->ident} and tagtype='weblog') and tagtype='weblog' and p.ident!={$post->ident}) and ($where) order by rand() limit 5
obviously, all those joins and subqueries makes it really inefficient and goes in the slow log half the time.