[Register]
Powered by Elgg

Plugins :: Blog :: [Updated] Related posts plugin

May 17, 2007

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>

Keywords: next, plugin, posts, previous, related

Posted by Rolando Espinoza La Fuente @ Plugins


Comments

  1. 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);

    user iconRolando Espinoza La Fuente on Thursday, 17 May 2007, 22:46 UTC # |

  2. Just put it in, working fine, I'll keep an eye on the stuff its relating to and get back with more feedback. Thanks

    user iconChris on Friday, 18 May 2007, 07:36 UTC # |

  3. 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 

    user iconRenato on Saturday, 19 May 2007, 01:17 UTC # |

  4. Hi Renato,

    i recently update my working copy, and updated info about installing on latest version. (see the post).

    Any feedback would be appreciate.

    user iconRolando Espinoza La Fuente on Saturday, 19 May 2007, 20:31 UTC # |

  5. 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. 

    user iconJP Loh on Friday, 07 September 2007, 19:59 UTC # |

You must be logged in to post a comment.

Site supported by Curverider Ltd - powered by the awesome Elgg