MyBB Community Forums

Full Version: ASOI problem with unviewable forums..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Well I thought this was fixed but apparently not. It could be that in an update this has broken. On Advanced Stats On Index plugin you can view a hidden forums thread in "newest threads". There is a parameter for $unviewableforums but apparently something isn't working correctly.

Anyone have an idea?

If you run this module you should check this feature as subjects in your admin/staff or other hidden areas will be viewable.

Here is the function not working...

function asoi_get_unviewable_forums()
{
	global $db, $forum_cache, $permissioncache, $mybb, $unviewableforums, $unviewable, $templates, $forumpass;

	$pid = intval($pid);

	if(!$permissions)
	{
		$permissions = $mybb->usergroup;
	}
	if(!is_array($forum_cache))
	{
		cache_forums();
	}
	if(!is_array($permissioncache))
	{
		$permissioncache = forum_permissions();
	}
	foreach($forum_cache as $fid => $forum)
	{
		if($permissioncache[$forum['fid']])
		{
			$perms = $permissioncache[$forum['fid']];
		}
		else
		{
			$perms = $mybb->usergroup;
		}
		$pwverified = 1;
		if($forum['password'] != "")
		{
			if($_COOKIE['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
			{
				$pwverified = 0;
			}
		}
		if($perms['canview'] == "no" || $pwverified == 0)
		{
			if($unviewableforums)
			{
				$unviewableforums .= ",";
			}
			$unviewableforums .= "'".$forum['fid']."'";
		}
	}
	return $unviewableforums;
}

Edit: I just noticed this function isn't even called in the page AT ALL. This is the beginning of the page though that does relate to the forum permissions. Something isn't working obviously.

//PLUGIN HOOK FUNCTIONS
function asoi($page)
{
	global $db, $lang, $mybb, $cache, $theme, $forum_cache, $templates;
	// Get forum permissions
	if(!is_array($forum_cache))
	{
		cache_forums();
	}
	foreach($forum_cache as $fid => $forum)
	{
		$perms = forum_permissions($forum['fid']);
		$pwverified = 1;
		if($forum['password'] != "")
		{
			if($_COOKIE['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
			{
				$pwverified = 0;
			}
		}
		if($perms['canview'] == "no" || $pwverified == 0)
		{
			if($unviewableforums)
			{
				$unviewableforums .= ",";
			}
			$unviewableforums .= "'".$forum['fid']."'";
		}
	}
	$fidnot = '1=1';
	if($unviewableforums)
	{
		$fidnot = "fid NOT IN ($unviewableforums)";
	}
Alright..just to post my findings...

$fidnot = '1=1';

That code is in the second function and basically it's useless for the entire script. He has $fidnot all over the place but it doesn't work.

EDIT: Ok..I have realised that the function asoi_get_unviewable_forums() is just a copy of the official mybb function get_unviewable_forums(). However neither is called properly in ASOI.

The code used to call that function in places like stats.php is the following.

// Get forum permissions
$unviewableforums = get_unviewable_forums();
$fidnot = '1=1';
if($unviewableforums)
{
	$fidnot = "fid NOT IN ($unviewableforums)";
}

Yet I have been unable to get it to work on the asoi.php plugin file.

Some help here would really be appreciated. I know this worked around version 1.2.7.
I would appreciate any help. I asked LEX about this and he looked into it..

Here is what he said.

Quote:Seems like the "permissionscache" doesn't return much usefull. I'v set all canview permissions to "no" ; rebuild the cache, but still it gives a yes to "canview" =P

So is this some sort of mybb bug?
3 days later still not responses..I was hoping to get this addressed. It's a serious problem when I post inside my staff area and the subject is viewable to all members.
One would think that such a popular plugin have a problem such as this would get SOME response. Is there a problem understanding the issue?
labrocca Wrote:One would think that such a popular plugin have a problem such as this would get SOME response. Is there a problem understanding the issue?

Maybe you should change the name of the title to something like this: "Private forum error".
Regards.
Or maybe "labrocca" choke them up, like when they saw the thread and said,... WHAT "labrocca" HAVE A PROBLEM..... ARRHHH *choked* and faint....
DragonLord Wrote:Or maybe "labrocca" choke them up, like when they saw the thread and said,... WHAT "labrocca" HAVE A PROBLEM..... ARRHHH *choked* and faint....

More than likely. I originally spent 3 hours on this. Then I figured a quick post would get it resolved and I could fix it later...now it's been over a week and yesterday I took another look and wasted 2 hours and got nowhere.

get_unviewable_forums() works in places like stats.php and misc.php but not for index.php or at least the hook for pre_output_page. When I changed the hook to index_start well then the get_unviewable_forums() worked BUT...the rest of the plugin did not. So basically at this point I am basically screwed since no one here appears willing or able to assist. Shame since this is a popular plugin which now appears broken and abandonded.
Hello labrocca, i´ve the same problem. I don´t know how to fix it.
Please help.


Sebastian
I think there isn't any outcome yet. I've been having the same problem, with all MyBB versions, that's why I never used the plugin again. Toungue
Pages: 1 2 3