]> git.mxchange.org Git - friendica.git/commitdiff
New plugin that shows community pages in the sidebar
authorMichael Vogel <icarus@dabo.de>
Sun, 11 Mar 2012 13:22:19 +0000 (14:22 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 11 Mar 2012 13:22:19 +0000 (14:22 +0100)
addon/pages/README [new file with mode: 0755]
addon/pages/pages.php [new file with mode: 0755]

diff --git a/addon/pages/README b/addon/pages/README
new file mode 100755 (executable)
index 0000000..6ec314b
--- /dev/null
@@ -0,0 +1,3 @@
+Pages
+
+Shows lists of community pages
diff --git a/addon/pages/pages.php b/addon/pages/pages.php
new file mode 100755 (executable)
index 0000000..13e6c4b
--- /dev/null
@@ -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'];
+
+}
+
+?>