aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-15 20:16:51 -0800
committerzotlabs <mike@macgirvin.com>2017-11-15 20:16:51 -0800
commitd13a6180be310cb184f891fa2b969542691c1863 (patch)
tree17ae2c5d176988b85c66987756ba1db5ea6204e3 /Zotlabs/Widget
parentd479ed00e4d4dd52ce139191c91911399df98a48 (diff)
downloadvolse-hubzilla-d13a6180be310cb184f891fa2b969542691c1863.tar.gz
volse-hubzilla-d13a6180be310cb184f891fa2b969542691c1863.tar.bz2
volse-hubzilla-d13a6180be310cb184f891fa2b969542691c1863.zip
Add private forums to forum widget. The link redirects to the remote channel page rather than a filtered view of your network page because you cannot post to a private forum from your own site.
Diffstat (limited to 'Zotlabs/Widget')
-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>';
}