aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Forums.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-19 17:39:19 -0800
committerzotlabs <mike@macgirvin.com>2017-11-19 17:39:19 -0800
commit4cd0b745cbc24a035a5e9ba488917ec7beeda888 (patch)
treefaad8cf0e7ef2a720ce002e6b280ae31a77971d0 /Zotlabs/Widget/Forums.php
parentcf4588f16fbe6dc55eabdb590480bc88d560dad3 (diff)
parent88d0bf94d89ac739469528bdab7905d0c00cf8a9 (diff)
downloadvolse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.tar.gz
volse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.tar.bz2
volse-hubzilla-4cd0b745cbc24a035a5e9ba488917ec7beeda888.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Widget/Forums.php')
-rw-r--r--Zotlabs/Widget/Forums.php32
1 files changed, 29 insertions, 3 deletions
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index 002c0ee21..91b987746 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -29,18 +29,32 @@ class Forums {
);
if($x1) {
$xc = ids_to_querystr($x1,'xchan',true);
+
$x2 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'tag_deliver' and v = '1' and xchan in (" . $xc . ") ",
intval(local_channel())
);
- if($x2)
+
+ if($x2) {
$xf = ids_to_querystr($x2,'xchan',true);
+
+ // private forums
+ $x3 = q("select xchan from abconfig where chan = %d and cat = 'their_perms' and k = 'post_wall' and v = '1' and xchan in (" . $xc . ") and not xchan in (" . $xf . ") ",
+ intval(local_channel())
+ );
+ if($x3) {
+ $xf = ids_to_querystr(array_merge($x2,$x3),'xchan',true);
+ }
+ }
}
$sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
- $r1 = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d $sql_extra order by xchan_name $limit ",
+
+
+ $r1 = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 $sql_extra order by xchan_name $limit ",
intval(local_channel())
);
+
if(! $r1)
return $o;
@@ -85,9 +99,21 @@ class Forums {
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';
foreach($r1 as $rr) {
+
+ $link = 'network?f=&pf=1&cid=' . $rr['abook_id'];
+ if($x3) {
+ foreach($x3 as $xx) {
+ if($rr['xchan_hash'] == $xx['xchan']) {
+ $link = zid($rr['xchan_url']);
+ }
+ }
+ }
+
if($unseen && (! intval($rr['unseen'])))
continue;
- $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&pf=1&cid=' . $rr['abook_id'] . '" ><span class="badge badge-secondary float-right">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
+
+
+ $o .= '<li class="nav-item"><a class="nav-link" href="' . $link . '" ><span class="badge badge-secondary float-right">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
}
$o .= '</ul></div>';
}