Quote:
Originally Posted by Michelle
Btw I noticed another bug with this: If in a forum a user can only view own threads and not others' threads, the permission doesn't get applied to the new posts: He can view others' threads from that forum as well.
|
Here's how to fix this
In plugins Alp Ajax Start and Alp Load find:
PHP Code:
$excludedforums = '';
add below:
PHP Code:
$ownthreadsforums = '';
Find:
PHP Code:
if (!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) {
$excludedforums = $excludedforums . ',' . $forum['forumid'];
}
Add below:
PHP Code:
else if(!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND !$vbulletin->options['showprivateforums'])
{
//can can't view others' threads here
$ownthreadsforums .= ',' . $forum['forumid'];
}
Find:
PHP Code:
// get rid of initial comma
$excludedforums = substr($excludedforums, 1);
Add below:
PHP Code:
$ownthreadsforums = substr($ownthreadsforums, 1);
Find:
PHP Code:
if ($excludedforums != "") {
$excludedforums = "AND thread.forumid NOT IN ($excludedforums)";
}
Add below:
PHP Code:
if($ownthreadsforums != '')
{
$ownthreadsforums = "AND (thread.forumid NOT IN ($ownthreadsforums) OR thread.postuserid = " . $vbulletin->userinfo['userid'] . ')';
}
Find (this is in the query):
PHP Code:
NOT ISNULL(thread.threadid)
$excludedforums
add below:
PHP Code:
$ownthreadsforums