This tutorial can be considered as Unofficial module, if you implement it in your Pligg, there is no problem with upgrading to a newer version of Pligg. For developers it could be quite easy to make an official module (when Pligg 1.0 comes I suppose).
The result looks like this:

As you can see, the search term (in english "programming") has two Experts. The first one (me:P) has 6 links where is search term used, the second one has one link.
Requirements
- Pligg 9.X version,personally I have v9.7, implementation into 9.8 possible
- yget template (default,blue)
- Notepad++,PhpEd or PHPdesigner...whatever good for PHP work
File requirements:
Just this little size image for background:
http://vselink.org/downloads/expert_backg.png
This image is supposed to be in your templates/yget/images folder
Steps to do:
1.1 Open your sidebar.tpl file and add this code, I preffer to be first of sidebar modules but do what you want:
Code:
{if $result neq false}{if $search_term neq false}
{assign var=sidebar_module value="sidebar_experts"}{include file=$the_template_sidebar_modules."/wrapper.tpl"}
{/if}{/if}
Code:
{* ----- show the sidebar experts box ----- *}
{php}include('sidebar_experts.php');{/php}
{* ---------------------------------------- *}
Add following code:
PHP Code:
<?php
//==========================================================================
// SIDEBAR EXPERTS MODULE
// This module shows in sidebar 5 people who are the most interested in
// specific area which is defined by a search term
//
//@created by AnAlienHolakres3 for Pligg community. Free for use,no warranty
//==========================================================================
include_once('Smarty.class.php');
$main_smarty = new Smarty;
include_once('config.php');
include_once(mnminclude.'html1.php');
include_once(mnminclude.'link.php');
include_once(mnminclude.'tags.php');
include_once(mnminclude.'search.php');
include_once(mnminclude.'smartyvariables.php');
include_once(mnminclude.'friend.php');
include_once(mnminclude.'user.php');
$search_term = trim($_REQUEST['search']);
//if $search_term exists, we want to show experts in sidebar
if ($search_term!=null){
showExperts();
}
// -------------------------------------------------------------------------------------
// function showExperts() search best users for specific search term:
// 1) names + count of users who have the most tags of searched term
// --------------------------------------------------------------------------------------
function showExperts() {
global $the_template, $main_smarty, $db ,$user;
$search_term = trim($_REQUEST['search']);
$limit_users = 5; // You can customize num of users displayed by changing $limit_users value
//display sidebar box
echo "<div class=\"tlb\" style=\"margin-top:-15px\"><span><a onclick=\"new Effect.toggle('sideexperts','blind', {queue: 'end'}); \"> <img src=\""
.my_base_url."/templates/" . $the_template . "/images/expand.png\" width=\"30\" height=\"29\"/></a></span><b>"
.$main_smarty->get_config_vars('PLIGG_Visual_Experts_For')."<font color='#0000CC'>".$search_term."</font></b></a></div>
<div id=sideexperts>";
//get the best people
$bp = $db->get_results ("SELECT distinct(user_login) AS 'user_name', count(user_login) AS 'tag_count' FROM ". table_users . " INNER JOIN ". table_links .
" ON " . table_users . ".user_id = " . table_links . ".link_author INNER JOIN ". table_tags ." ON ".table_links . ".link_id = ". table_tags.
".tag_link_id WHERE tag_words LIKE '".$search_term. "' GROUP BY user_login ORDER BY tag_count DESC");
//display table header
echo "<table border='0' style='border: 1px solid #3333FF;width:235px;margin-top:12px;margin-bottom:14px;padding-bottom:3px;
background: url(".my_pligg_base."/templates/".$the_template."/images/expert_backg.png) repeat-y'><td style='text-align=center'><b>"
.$main_smarty->get_config_vars('PLIGG_Visual_Experts_Username')."</b></td><td align='center'><b>"
.$main_smarty->get_config_vars('PLIGG_Visual_Experts_Num_Of_Links')."</b></td>";
//get expert names and num of tags
foreach($bp as $best_person) {
$best_person_name = $best_person->user_name;
$best_person_count = $best_person->tag_count;
echo "<tr>";
echo '<td><a href="'.getmyurl('user2', $best_person_name, 'profile'). '">'.$best_person_name. '</a></td>';
echo "<td style='text-align:center'><span style='background: #D9E0FF; border: 1px solid #0000CC;padding-right:5px;padding-left:5px'>" .$best_person_count. "</span></td>";
}
//table end
echo "</tr></table><div id='iefix' style='display:none;height:0px'></div></div>";
//IE fix
echo "<!--[if lt IE 8]>
<style type='text/css' media='screen'>
#iefix {display:block !important}
</style>
<![endif]--> ";
}
?> Code:
4) add to lang.conf in your ../libs/ folder to sidebar section: //<SECTION>SIDEBAR</SECTION><ADDED>0.9X</ADDED> PLIGG_Visual_Experts_For= "Experti na " //<SECTION>SIDEBAR</SECTION><ADDED>0.9X</ADDED> PLIGG_Visual_Experts_Username= "Uživatelské jméno" //<SECTION>SIDEBAR</SECTION><ADDED>0.9X</ADDED> PLIGG_Visual_Experts_Num_Of_Links= "Počet záložek"
1.5.1: Find function new_search and add global variable $main_smarty.
1.5.2: Find if ($links) { condition. Please note there is 2x and you have to add 2 times this code :
$main_smarty->assign('result',1);
So it should be like this:
Code:
if ($links) {
$main_smarty->assign('result',1);
foreach($links as $link_id) {
if(array_search($link_id->link_id, $foundlinks) === false){





Linear Mode

