1
0
Fork 0

New plugin that shows community pages in the sidebar

This commit is contained in:
Michael Vogel 2012-03-11 14:22:19 +01:00
parent 670b571c8a
commit eb3b211461
2 changed files with 42 additions and 0 deletions

3
addon/pages/README Executable file
View file

@ -0,0 +1,3 @@
Pages
Shows lists of community pages

39
addon/pages/pages.php Executable file
View file

@ -0,0 +1,39 @@
<?php
/**
* Name: Pages
* Description: Shows lists of community pages
* Version: 1.0
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
function pages_install() {
register_hook('page_end', 'addon/pages/pages.php', 'pages_page_end');
}
function pages_uninstall() {
unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end');
}
function pages_page_end($a,&$b) {
if (($a->module != "network") OR ($a->user['uid'] == 0))
return;
$pages = '<div id="pages-sidebar" class="widget"><h3>'.t("Community").'</h3><ul>';
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`Name` FROM `contact`, `user`
WHERE `network`= 'dfrn' AND `duplex`
AND `contact`.`nick`=`user`.`nickname`
AND `user`.`page-flags`= %d
AND `contact`.`uid` = %d",
intval(PAGE_COMMUNITY),
intval($a->user['uid']));
foreach($contacts as $contact) {
$pages .= '<li class="tool"><a href="'.$contact["url"].'">'.$contact["Name"]."</a></li>";
}
$pages .= "</ul>";
if (sizeof($contacts) > 0)
$a->page['aside'] = $pages.$a->page['aside'];
}
?>