From d13a6180be310cb184f891fa2b969542691c1863 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Nov 2017 20:16:51 -0800 Subject: 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. --- Zotlabs/Widget/Forums.php | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Widget/Forums.php') 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 .= '

' . t('Forums') . '

'; } -- cgit v1.2.3