From f0acb9f01e0e2e130121dff435dea4a29f460d8e Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 16 Oct 2020 11:43:21 +0000 Subject: get_forum_channels(): fix an issue where we would not look for private forums in case we did not have any channels where tag_deliver is set --- include/text.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 0a54ddd2f..ec397910d 100644 --- a/include/text.php +++ b/include/text.php @@ -3677,22 +3677,21 @@ function get_forum_channels($uid) { intval($uid) ); - if($x2) { - $xf = ids_to_querystr($x2,'xchan',true); + $xf = ids_to_querystr($x2,'xchan',true); + $sql_extra = (($xf) ? ' and not xchan in (' . $xf . ')' : ''); - // 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); - } + // 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 . ") $sql_extra ", + 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 "); + $sql_extra_1 = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 "); - $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_addr, 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 and abook_archived = 0 $sql_extra order by xchan_name", + $r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_addr, 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 and abook_archived = 0 $sql_extra_1 order by xchan_name", intval($uid) ); -- cgit v1.2.3