Just replace original function sidebarExtraCats() in dbtree.php file:
PHP Code:
//------------------------------------------------------------------------------
// Function sidebarExtraCats provides information for categories.tpl
//@param status_mode - it is set in search.php and it can be:
// all,published or queued.
//@creator:AnAlienHolakres3-For Pligg Community:Free for use,NO WARRANTY
// SUBCAT LEVEL 3 FULLY SUPPORTED
//--------------------------------------------------------------------------------
function sidebarExtraCats($status_mode) {
global $main_smarty,$db;
$root_id=Array();
$array = tree_to_array(0, table_categories);
//get array of categories
foreach ($array as $cat) {
$cat_id[]=$cat['auto_id'];
}
//get array of subcategories
foreach ($array as $subcat) {
$cat_parent[]=$subcat['parent'];
}
//get array of roots
$roots=$db->get_results("SELECT category_id FROM ".table_categories." WHERE category_parent=0");
//get num of links in root category (and its subcats) (ALL-ALWAYS)
foreach ($roots as $roots_id){
$root_count_array_total[$roots_id->category_id]=
$db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_category=".$roots_id->category_id.
" OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
" UNION SELECT distinct subcat2.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".category_id".
" JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
" WHERE ".table_categories.".category_id=".$roots_id->category_id.")");
//the same,but only PUBLISHED
if ($status_mode=="published"){
$root_count_array[$roots_id->category_id]=
$db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=3 AND (link_category=".$roots_id->category_id.
" OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
" UNION SELECT distinct subcat2.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".category_id".
" JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
" WHERE ".table_categories.".category_id=".$roots_id->category_id."))");
//the same,but only QUEUED
}elseif ($status_mode=="queued"){
$root_count_array[$roots_id->category_id]=
$db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=2 AND (link_category=".$roots_id->category_id.
" OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
" UNION SELECT distinct subcat2.category_id FROM ".table_categories.
" JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".category_id".
" JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
" WHERE ".table_categories.".category_id=".$roots_id->category_id."))");
//all
}else {
$root_count_array=$root_count_array_total;
}
}
//compare and set root ids with subcats
foreach ($cat_id as $category_id){
foreach ($cat_parent as $category_parent){
if ($category_id && $category_parent) {
if ($category_id==$category_parent) {
if(!in_array($category_id,$root_id)) {
$root_id[] = $category_id;
}
}
}
}
}
$main_smarty->assign('root_id',$root_id);
$main_smarty->assign('links_count_root_array',$root_count_array);
$main_smarty->assign('links_count_root_array_total',$root_count_array_total);
$main_smarty->assign('extra_sidebar_set',1);
}
Of course you can test in on http://vselink.org/098/.
Hope it is all






Ill take a look at the video when I get the chance...for now I want to toy around with this
Linear Mode




