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.
This commit is contained in:
parent
d479ed00e4
commit
d13a6180be
@ -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>';
|
||||
}
|
||||
|
Reference in New Issue
Block a user